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 02-19-2014, 08:45 AM
Vaporman87 Vaporman87 is offline
Member
 
Join Date: Feb 2014
Posts: 32
Gender: Male
Credits: 4,930
Vaporman87 is on a distinguished road
Default Placing descriptions on the My Adopts page

I would like for the user to see not just the image of the adoptable, but also the description included during it's creation in the ACP (when viewing the adoptable in My Adopts)

Any suggestions on how to go about doing this?
Reply With Quote
  #2  
Old 02-19-2014, 11:39 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,356
IntoRain is on a distinguished road
Default

Directly on the stats page? Or when you click on it?

If you look at the database you will see that the description is associated with an Adoptable and not an OwnedAdoptable. So we have to get the species to get the description. Basically, through the OwnedAdoptable's type, we get the Adoptable and then we return the description.

In code-words, in the file class_ownedadoptable.php we add a protected $type; to the list at the top then we add this function:

public function getDescription(){
$adopt = new Adoptable($this->type);
return $adopt->getDescription();
}

So if you want it in the stats page, you just needed to add a comment on the getStats() function in the class_ownedadoptable.php file like:

$stats->add(new Comment("<br>Description: ",FALSE));
$stats->add(new Comment($this->getDescription()));

So you class_ownedadoptable.php should look like this:

PHP Code:
<?php

class OwnedAdoptable extends Adoptable{

    protected 
$aid;
    protected 
$name;
    protected 
$owner;
    protected 
$currentlevel;
    protected 
$totalclicks;
    protected 
$code;
    protected 
$imageurl;
    protected 
$usealternates;
    protected 
$tradestatus;
    protected 
$isfrozen;  
    protected 
$gender;
    protected 
$offsprings;
    protected 
$lastbred;
    protected 
$nextlevel;
    protected 
$voters;
    protected 
$motherID;
    protected 
$fatherID;
    protected 
$type;//add this
  
    
public function __construct($aid$owner ""){      
       (... 
rest of function)
    }
    
        
//add this function
    
public function getDescription(){
        
$adopt = new Adoptable($this->type);
        return 
$adopt->getDescription();
    }

(
rest of code here)...
    
    public function 
getStats(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();    
        
$stats = new Division("adoptstats");
        
$stats->add(new Comment("<br><br><b>Total Clicks: {$this->totalclicks}"));
        
$stats->add(new Comment("Gender: "FALSE));
        
$stats->add(new Image("picuploads/{$this->gender}.png"));

                
//add this
        
$stats->add(new Comment("<br>Description: ",FALSE));
        
$stats->add(new    Comment($this->getDescription()));

        if(
$this->hasNextLevel()){
            
$level $this->getNextLevel();
            
$levelupClicks $this->getLevelupClicks();
            
$nextLevel $level->getLevel().$mysidia->lang->clicks.$levelupClicks
        }
        else 
$nextLevel $mysidia->lang->maximum;
        
        
$adoptStats "<br>Trade Status: {$this->tradestatus}<br>
                       Current Level: 
{$this->currentlevel}<br>Next Level: {$nextLevel}</b>";
        
$stats->add(new Comment($adoptStats));
        if(
$this->getMotherID() != NULL){
            
$stats->add(new Comment("<br><b>Mother:</b> <a href='../../levelup/click/{$this->getMotherID()}'>{$this->getMother()->getName()}</a><br><b>Father:</b> <a href='../../levelup/click/{$this->getFatherID()}'>{$this->getFather()->getName()}</a>"));
        }
        return 
$stats;        
    }
}
?>
__________________


asp.net stole my soul.

Last edited by IntoRain; 02-19-2014 at 11:44 AM.
Reply With Quote
  #3  
Old 02-19-2014, 12:34 PM
Vaporman87 Vaporman87 is offline
Member
 
Join Date: Feb 2014
Posts: 32
Gender: Male
Credits: 4,930
Vaporman87 is on a distinguished road
Default

Into Rain: That was exactly what I was looking for.

This brings me to another question though. There is a limit on the characters that can be entered into the description of an adoptable. This is fine with me as it pertains to its use in the Adoptshop, but when it is sent over to the stats page, I want there to be a much larger limit on the character value.

So, this would involve cutting short the description in the Adoptshop, but still maintaining the extra characters in the database for when the description shows up on the stats page.

Again, my sincere thanks for your assistance.
Reply With Quote
  #4  
Old 02-19-2014, 06:43 PM
squiggler's Avatar
squiggler squiggler is offline
Squiggling since 1995
 
Join Date: Jul 2013
Posts: 185
Gender: Unknown/Other
Credits: 8,177
squiggler is on a distinguished road
Default

If there isn't a simple code for this, a work around I've found is to create a page with all the adoptables and their descriptions. You could also create separate pages for each, and a promocode is given to unlock each page.
__________________
Avatar courtesy of Doll Divine.
Reply With Quote
  #5  
Old 02-19-2014, 09:31 PM
Hall of Famer's Avatar
Hall of Famer Hall of Famer is offline
Administrator, Lead Coder
 
Join Date: Dec 2008
Location: South Brunswick
Posts: 4,448
Gender: Male
Credits: 331,781
Hall of Famer is on a distinguished road
Default

Quote:
Originally Posted by IntoRain View Post
Directly on the stats page? Or when you click on it?

If you look at the database you will see that the description is associated with an Adoptable and not an OwnedAdoptable. So we have to get the species to get the description. Basically, through the OwnedAdoptable's type, we get the Adoptable and then we return the description.

In code-words, in the file class_ownedadoptable.php we add a protected $type; to the list at the top then we add this function:

public function getDescription(){
$adopt = new Adoptable($this->type);
return $adopt->getDescription();
}

So if you want it in the stats page, you just needed to add a comment on the getStats() function in the class_ownedadoptable.php file like:

$stats->add(new Comment("<br>Description: ",FALSE));
$stats->add(new Comment($this->getDescription()));

So you class_ownedadoptable.php should look like this:

PHP Code:
<?php

class OwnedAdoptable extends Adoptable{

    protected 
$aid;
    protected 
$name;
    protected 
$owner;
    protected 
$currentlevel;
    protected 
$totalclicks;
    protected 
$code;
    protected 
$imageurl;
    protected 
$usealternates;
    protected 
$tradestatus;
    protected 
$isfrozen;  
    protected 
$gender;
    protected 
$offsprings;
    protected 
$lastbred;
    protected 
$nextlevel;
    protected 
$voters;
    protected 
$motherID;
    protected 
$fatherID;
    protected 
$type;//add this
  
    
public function __construct($aid$owner ""){      
       (... 
rest of function)
    }
    
        
//add this function
    
public function getDescription(){
        
$adopt = new Adoptable($this->type);
        return 
$adopt->getDescription();
    }

(
rest of code here)...
    
    public function 
getStats(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();    
        
$stats = new Division("adoptstats");
        
$stats->add(new Comment("<br><br><b>Total Clicks: {$this->totalclicks}"));
        
$stats->add(new Comment("Gender: "FALSE));
        
$stats->add(new Image("picuploads/{$this->gender}.png"));

                
//add this
        
$stats->add(new Comment("<br>Description: ",FALSE));
        
$stats->add(new    Comment($this->getDescription()));

        if(
$this->hasNextLevel()){
            
$level $this->getNextLevel();
            
$levelupClicks $this->getLevelupClicks();
            
$nextLevel $level->getLevel().$mysidia->lang->clicks.$levelupClicks
        }
        else 
$nextLevel $mysidia->lang->maximum;
        
        
$adoptStats "<br>Trade Status: {$this->tradestatus}<br>
                       Current Level: 
{$this->currentlevel}<br>Next Level: {$nextLevel}</b>";
        
$stats->add(new Comment($adoptStats));
        if(
$this->getMotherID() != NULL){
            
$stats->add(new Comment("<br><b>Mother:</b> <a href='../../levelup/click/{$this->getMotherID()}'>{$this->getMother()->getName()}</a><br><b>Father:</b> <a href='../../levelup/click/{$this->getFatherID()}'>{$this->getFather()->getName()}</a>"));
        }
        return 
$stats;        
    }
}
?>
Actually there is no need to add a type field and getDescription() method in class OwnedAdpptable, since this class extends from the parent Adoptable class so all properties/methods are inherited. You can just access the type field and getDescription() method directly inside or outside the class.
__________________


Mysidia Adoptables, a free and ever-improving script for aspiring adoptables/pets site.
Reply With Quote
  #6  
Old 02-20-2014, 06:22 AM
Vaporman87 Vaporman87 is offline
Member
 
Join Date: Feb 2014
Posts: 32
Gender: Male
Credits: 4,930
Vaporman87 is on a distinguished road
Default

All that being said, are there any suggestions for this in terms of code changes?:

"There is a limit on the characters that can be entered into the description of an adoptable. This is fine with me as it pertains to its use in the Adoptshop, but when it is sent over to the stats page, I want there to be a much larger limit on the character value.

So, this would involve cutting short the description in the Adoptshop, but still maintaining the extra characters in the database for when the description shows up on the stats page."
Reply With Quote
  #7  
Old 02-21-2014, 12:40 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,356
IntoRain is on a distinguished road
Default

Oops, didn't notice the inheritance! My bad! Thank you, HoF!

Quote:
Originally Posted by Vaporman87 View Post
All that being said, are there any suggestions for this in terms of code changes?:

"There is a limit on the characters that can be entered into the description of an adoptable. This is fine with me as it pertains to its use in the Adoptshop, but when it is sent over to the stats page, I want there to be a much larger limit on the character value.

So, this would involve cutting short the description in the Adoptshop, but still maintaining the extra characters in the database for when the description shows up on the stats page."
Instead of cutting the description, maybe you could add another column to the adoptable table for a second description with more space? And then you'd call it based on which page you were
__________________


asp.net stole my soul.
Reply With Quote
  #8  
Old 02-21-2014, 02:02 PM
Vaporman87 Vaporman87 is offline
Member
 
Join Date: Feb 2014
Posts: 32
Gender: Male
Credits: 4,930
Vaporman87 is on a distinguished road
Default

How would I go about adding a function to get the new table?

EDIT: Actually scratch that... I just added the following...

Code:
public function getDescription2(){
	    return $this->description2;
}

and...


$stats->add(new Comment("<br>Backstory: ",FALSE));
        $stats->add(new Comment($this->getDescription2()));
And that did the trick!

Thanks again!

Last edited by Vaporman87; 02-21-2014 at 02:12 PM.
Reply With Quote
Reply


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
My Adopts Page parayna Questions and Supports 14 03-09-2016 09:53 PM
Pagination/ My Adopts Page Missy Master Suggestions and Feature Requests 13 01-23-2011 08:37 PM
Neater Adopts Page LilPixie Questions and Supports 0 09-06-2009 10:14 PM
My Adopts Page Seapyramid Addons/Mods Graveyard 8 05-02-2009 03:04 PM


All times are GMT -5. The time now is 07:35 PM.

Currently Active Users: 387 (0 members and 387 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