Mysidia Adoptables Support Forum  

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

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-05-2016, 10:14 AM
Kyttias's Avatar
Kyttias Kyttias is offline
Premium Member
 
Join Date: Jan 2014
Posts: 857
Gender: Unknown/Other
Credits: 139,771
Kyttias is on a distinguished road
Default

I made a mod that allows for a more customizable index page (rather than using the AdminCP), and it will allow you to use PHP. In the mod I also included example code for displaying five random pets. Check it out!

The exact code snippet for the random pets is this:
PHP Code:
$document->add(new Comment("<div class='row'><h4>Random 5 Pets</h4>"FALSE));
        
$stat_rand5 $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY RAND() DESC LIMIT 5");        
        while(
$aid $stat_rand5->fetchColumn()){
            
$adopt = new OwnedAdoptable($aid);    
            
$document->add(new Comment("
                <div style='display: inline-table; text-align: center;'>
                <a href='levelup/click/
{$adopt->getAdoptID()}'><img src='{$adopt->getImage()}'></a></br>
                  <a href='levelup/click/
{$adopt->getAdoptID()}'><b>{$adopt->getName()}</b></a> the <small><b>LVL.</b> {$adopt->getCurrentLevel()}</small> {$adopt->getType()}</div>
              "
FALSE));
        }
        
$document->add(new Comment("</div>"FALSE)); 
If you want three instead of five, all you have to do is edit "1 ORDER BY RAND() DESC LIMIT 5" to "1 ORDER BY RAND() DESC LIMIT 3".
__________________
Please do not contact me directly outside of Mysidia.
I also cannot troubleshoot code more than two years old - I legit don't remember it.
Reply With Quote
 


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 01:40 AM.

Currently Active Users: 2049 (0 members and 2049 guests)
Threads: 4,081, Posts: 32,043, 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 - 2025, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636