Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Display number of items in a user's inventory (http://www.mysidiaadoptables.com/forum/showthread.php?t=5540)

laurenannedaniel 12-20-2017 11:10 AM

Display number of items in a user's inventory
 
Hi again -

Is there a way to display the number of items in a user's inventory? I would think that it would be displaying $total from class_inventory.php but have not yet found the right syntax for it to work.

On my site I have a top bar with their UN, number of new messages, etc. and I wanted to display it there so I think I need something for class_template.php so that I could just put {$total} in my template where I want to display the number.

Thanks!

Dinocanid 12-20-2017 02:08 PM

You could put this in class_template.php under "private function assignTemplateVars()":
PHP Code:

$itemTotal$mysidia->db->select("inventory", array("iid"), "owner = '{$mysidia->user->username}'")->rowCount();
$this->assign("itemTotal",$itemTotal); 

Now in your template.tpl you can display the user's total amount of items in the inventory with {$itemTotal}

laurenannedaniel 12-20-2017 04:14 PM

That worked perfectly, thanks so much!


All times are GMT -5. The time now is 02:07 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.