Display number of items in a user's inventory

Forum
Last Post
Threads / Messages

laurenannedaniel

Member
Member
Joined
Dec 15, 2017
Messages
3
Points
0
Mysidian Dollar
0
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!
 
You could put this in class_template.php under "private function assignTemplateVars()":
PHP:
$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}
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,278
Messages
33,127
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top