We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
  • Pages:
  • 1
  • 2
[ C ] Inventory Code; *read*
Topic Started: Jul 16 2011, 12:08 PM (2,183 Views)
harleighblake
Member
[ * ]
Board Address: Private
Board Software: ZB
Description: I just want a simple inventory code that an admin can add items to. I just want it to be like a link in the topics to their inventory and then yea.
Offline Profile Goto Top
 
Replies:
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Its possible to use only one webpage which a simple script could get the username (or more practical would be the user ID) from the link (and thus the URL) to display the relevant items.

Would you prefer that method?
Offline Profile Goto Top
 
harleighblake
Member
[ * ]
:o that would be a lot easier xD
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Put this Below the Board
Code:
 
<script type='text/javascript'>
var inventory = [
["Quozzo","Item 1"],
["Quozzo","Item 2"],
["Member","Item 1"],
["Quozzo","Item 3"]
];
if(/topic|single|announcement/.test(location.href)){
$('.user_profile').each(function(){
var uname = $(this).parent().parent().prev().find('.c_username').text();
for(var i=0,k=inventory.length,num=0;i<k;i++){
if(uname.match(inventory[i][0])){
num++
};
};
$(this).find('dt:last').next().after("<dt>Inventory</dt><dd><a href='"+main_url+"pages/inventory/#"+uname+"'>Inventory ("+num+")</a></dd>");
});
};

if(/pages\/inventory/.test(location.href)){
var uname = location.href.split("#")[1];
var invroll = "<tr><th>"+uname+"'s Inventory</th></tr>";
for(var i=0,k=inventory.length;i<k;i++){
if(inventory[i][0] == uname){
invroll += "<tr><td>"+inventory[i][1]+"</td></tr>";
};
};
$('#inventory').append(invroll);
};
</script>
and make a page called "inventory" and place this in it
Code:
 
<table id='inventory'></table>


Edit the list above, make sure every line as a comma at the end except the last.
Edited by Quozzo, Jul 17 2011, 06:29 PM.
Offline Profile Goto Top
 
familywin
Member
[ *  * ]
how do you put the item pic in there, Quozzo?
Offline Profile Goto Top
 
harleighblake
Member
[ * ]
Cory
Jul 16 2011, 04:31 PM
Code:
 
<img src="IMAGE_URL" alt="ITEM_NAME" />
that is my guess i have not tried to code yet
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
That does work, but you want to use apostrophes (') instead of quotation marks ("), otherwise is won't work unless you escape them with a backslash (\).
Offline Profile Goto Top
 
harleighblake
Member
[ * ]
oh awesome thanks :)
Offline Profile Goto Top
 
Roby-ZNR
Member Avatar
Efficacy
[ *  *  *  *  *  * ]
Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic
  • Pages:
  • 1
  • 2