Mysidia Adoptables Support Forum  

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

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 12-20-2017, 11:10 AM
laurenannedaniel laurenannedaniel is offline
Member
 
Join Date: Dec 2017
Posts: 3
Gender: Female
Credits: 1,294
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, 02:08 PM
Dinocanid's Avatar
Dinocanid Dinocanid is offline
Member
 
Join Date: Aug 2016
Location: Maryland, USA
Posts: 516
Gender: Unknown/Other
Credits: 63,613
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, 04:14 PM
laurenannedaniel laurenannedaniel is offline
Member
 
Join Date: Dec 2017
Posts: 3
Gender: Female
Credits: 1,294
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 07:33 AM.

Currently Active Users: 455 (0 members and 455 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


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