Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2017, 12:10 PM
laurenannedaniel laurenannedaniel is offline
Member
 
Join Date: Dec 2017
Posts: 3
Gender: Female
Credits: 197
laurenannedaniel is on a distinguished road
Default 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!
Reply With Quote
  #2  
Old 12-20-2017, 03:08 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 495
Gender: Unknown/Other
Credits: 19,422
Dinocanid is on a distinguished road
Default

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}
__________________
Reply With Quote
  #3  
Old 12-20-2017, 05:14 PM
laurenannedaniel laurenannedaniel is offline
Member
 
Join Date: Dec 2017
Posts: 3
Gender: Female
Credits: 197
laurenannedaniel is on a distinguished road
Default

That worked perfectly, thanks so much!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:55 AM.

Currently Active Users: 205 (1 members and 204 guests)
Threads: 3,932, Posts: 31,330, Members: 15,516
Welcome to our newest members, Nicholas Adam.
BER





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636