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 05-04-2014, 09:35 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,758
Hwona is on a distinguished road
Default Showing stats on click page

Hello! Sorry for yet another nuisance, but I've been trying to find a way to display an adoptable's stats on its levelup page after someone has viewed it more than once. I was thinking about having the stats displayed on the second view and adding a link after the first click, but I can't seem to get anything to work. I'm currently using version 1.3.3. Would anyone mind helping me?
PHP Code:
<?php

class LevelupController extends AppController{

    const 
PARAM "aid";
    private 
$view;
    private 
$subController;
    private 
$adopt;

    public function 
__construct(){
        
parent::__construct();
        
$mysidia Registry::get("mysidia");
        if(
$mysidia->input->action() == "click" or $mysidia->input->action() == "siggy"$this->adopt = new OwnedAdoptable($mysidia->input->get("aid"));
        if(
$mysidia->user instanceof Member){
            
$status $mysidia->user->getstatus();   
            if(
$status->canlevel == "no") throw new InvalidActionException($mysidia->lang->banned);
        }    
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        throw new 
InvalidActionException($mysidia->lang->global_action);
    }
    
    public function 
click(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();        
        
$date = new DateTime;
        
$ip secure($_SERVER['REMOTE_ADDR']);
        
$gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$adoptablename $mysidia -> db -> select ("owned_adoptables", array("name"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$species $mysidia -> db -> select ("owned_adoptables", array("type"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$totalclicks $mysidia -> db -> select ("owned_adoptables", array("name"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$tradestatus $mysidia -> db -> select ("owned_adoptables", array("tradestatus"), "aid='{$adopt->aid}'") -> fetchColumn();
        
        
    
    
        if(
$this->adopt->hasVoter($mysidia->user$date)){
            
// The user has leveled up this adoptable today, show error message
            
$message 'Name:' $adoptablename 'Species:' $species 'Gender:' $gender 'Total Clicks:' $totalclicks 'Trade Status:' $tradestatus;
            
$message = ($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest;
            
$document->setTitle($mysidia->lang->already_leveled_title);
            
$document->addLangvar($message);
        }
        elseif(
$this->adopt->isFrozen() == "yes"){
            
$document->setTitle($mysidia->lang->frozen_title);
            
$document->addLangvar($mysidia->lang->frozen);
        }
        else{
            
$newClicks $this->adopt->getTotalClicks() + 1;
            
$this->adopt->setTotalClicks($newClicks"update");
            
$mysidia->db->insert("vote_voters", array("void" => NULL"date" => $date->format('Y-m-d'), "username" => $mysidia->user->username"ip" => $ip"adoptableid" => $mysidia->input->get("aid")));         
            
            if(
$this->adopt->hasNextLevel()){
                
// A higher level does exist, so we see if it is time to level up
                
$nextLevel $this->adopt->getNextLevel();
                
$requiredClicks $nextLevel->getRequiredClicks();
                if(
$requiredClicks and $newClicks >= $requiredClicks$this->adopt->setCurrentLevel($nextLevel->getLevel(), "update");
            }
            
            
$document->setTitle("{$mysidia->lang->gave} {$this->adopt->getName()} one {$mysidia->lang->unit}");
            
$reward $mysidia->user->clickreward($mysidia->settings->rewardmoney);
            
$mysidia->user->changecash($reward);            
            
$image $this->adopt->getImage("gui");        
            
$image->setLineBreak(TRUE);    
            
            
$summary = new Division;
            
$summary->setAlign(new Align("center"));
            
$summary->add($image);    
            
$summary->add(new Comment("{$mysidia->lang->gave}{$this->adopt->getName()} one {$mysidia->lang->unit}."));
            
$summary->add(new Comment($mysidia->lang->encourage));
            
$summary->add(new Comment("<br>"));
            
$summary->add(new Comment(" You have earned {$reward} {$mysidia->settings->cost} for leveling up this adoptable. "));
            
$summary->add(new Comment("You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}"));
            
$document->add($summary);            
        }
    }

    public function 
siggy(){
        
$mysidia Registry::get("mysidia");
        
// The adoptable is available, let's collect its info
        
$usingimage "no";
        
$image $this->adopt->getImage(); 
      
        
$usegd $mysidia->settings->gdimages;
        
$imageinfo = @getimagesize($image);
        
$imagemime $imageinfo["mime"]; // Mime type of the image file, should be a .gif file...

        
if(function_exists('imagegif') and $usegd == "yes" and $imagemime == "image/gif"){
            
$usingimage "yes"//Turn the template system off
            
$type $this->adopt->getType();
            list(
$width$height$type$attr) = getimagesize($image); // The size of the original adoptable image

            // Lets create the new target image, with a size big enough for the text for the adoptable
            
$newheight $height 72;
            
$newwidth = ($newwidth 250)?250:$width;
            
$img_temp imagecreatetruecolor($newwidth$newheight); 
            
$alphablending true;  
         
            
// Lets create the image and save its transparency  
            
$img_old = @imagecreatefromgif($image);  
            
imagealphablending($img_oldtrue);  
            
imagesavealpha($img_oldtrue);
   
            
// Lets copy the old image into the new image with  
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);    
            
$textheight $width 2;
            
$image $img_temp;
            
$bgi imagecreatetruecolor($newwidth$newheight);
            
$color imagecolorallocate($bgi515151);
         
            
// Build text for siggy
            
$str1 "Name: ".$this->adopt->getName();
            
$str2 "Owner: ".$this->adopt->getOwner();
            
$str3 "Click Here to Feed Me!";
            
$str4 "More Adopts at:";
            
$str5 "www.".constant("DOMAIN");

            
// Renger Image
            
imagestring ($image120$textheight,  $str1$color);
            
imagestring ($image120$textheight 13,  $str2$color);
            
imagestring ($image120$textheight 26,  $str3$color);
            
imagestring ($image120$textheight 42,  $str4$color);
            
imagestring ($image120$textheight 55,  $str5$color);
            
$background imagecolorallocate($image000);  
            
ImageColorTransparent($image$background);  
 
            
// At the very last, let's clean up temporary files
            
header("Content-Type: image/GIF");
            
ImageGif ($image);
            
imagedestroy($image);
            
imagedestroy($img_temp);
            
imagedestroy($img_old);
            
imagedestroy($bgi);

        }
        else{      
                
// We are going to try and get this image the old fashioned way...
            
$extList = array();
            
$extList['gif'] = 'image/gif';
            
$extList['jpg'] = 'image/jpeg';
            
$extList['jpeg'] = 'image/jpeg';
            
$extList['png'] = 'image/png';

            
//Define the output file type
            
$contentType 'Content-type: '.$extList$imageinfo['extension'] ];

            if(
$imageinfo['extension'] =! "image/gif" and $imageinfo['extension'] =! "image/jpeg" and $imageinfo['extension'] =! "image/png"){             
                throw new 
InvalidIDException("The file Extension is not allowed!");
            }
            else{
                
// File type is allowed, so proceed
                
$status "";
                
header($contentType);
                
$curl = new Curl($image);
                
$curl->setHeader();
                
$curl->exec();
                
$curl->close();
            } 
        }
    }
    
    public function 
daycare(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$document->setTitle($mysidia->lang->daycare_title);
        
$document->addLangvar($mysidia->lang->daycareTRUE);
        
        try{
            
$daycare = new Daycare;
            
$adopts $daycare->getAdopts();
        }
        catch(
DaycareException $dae){
            
$message $dae->getmessage();
            
$document->addLangvar($mysidia->lang->{$message});
            return;
        }
        
        
$daycareTable = new Table("daycare"""FALSE);
        
$daycareTable->setBordered(FALSE);
        
$total $daycare->getTotalAdopts();
        
$index 0;

        for(
$row 0$row $daycare->getTotalRows(); $row++){
            
$daycareRow = new TRow("row{$row}");
            for(
$column 0$column $daycare->getTotalColumns(); $column++){
                
$adopt = new OwnedAdoptable($adopts[$index]);
                
$image = new Link("levelup/click/{$adopt->getAdoptID()}"$adopt->getImage("gui"), TRUE);
                
$stats = new Comment($daycare->getStats($adopt));
                
$daycareCell = new TCell(new ArrayObject(array($image$stats)), "cell{$index}");
                
$daycareCell->setAlign(new Align("center""center"));
                
$daycareRow->add($daycareCell);
                
$index++;
                if(
$index == $total) break;
            }
            
$daycareTable->add($daycareRow);            
        }
        
        
$document->add($daycareTable);
        if(
$pagination $daycare->getPagination()) $document->addLangvar($pagination->showPage());
    }
}

?>
All edits have been to the click function section of the script, but I don't think I'm getting or displaying the data correctly? I added a few extra variables and then a message to display them right under "the user has already leveled this adoptable today...".
Thank you so much!
__________________

Last edited by Hwona; 05-04-2014 at 09:40 AM.
Reply With Quote
  #2  
Old 05-04-2014, 10:19 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,374
IntoRain is on a distinguished road
Default

PHP Code:
if($this->adopt->hasVoter($mysidia->user$date)){
            
// The user has leveled up this adoptable today, show error message
            
$message 'Name:' $adoptablename 'Species:' $species 'Gender:' $gender 'Total Clicks:' $totalclicks 'Trade Status:' $tradestatus;
            
$message = ($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest;
            
$document->setTitle($mysidia->lang->already_leveled_title);
            
$document->addLangvar($message);
        } 
Saying message equals something and then message equals something else overwrites the previous value of message. Basically you are saying message = 1; and then message = 2;
I don't quite remember the appending operator, but you can do this:

$message = "Name: {$adoptablename}<br>
Species: {$species}<br>
Gender: {$gender}<br>
Total Clicks: {$totalclicks}<br>
Trade Status: {$tradestatus}<br>";
$message = $message .= (($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest);

PHP Code:
        $gender $mysidia -> db -> select ("owned_adoptables", array("gender"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$adoptablename $mysidia -> db -> select ("owned_adoptables", array("name"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$species $mysidia -> db -> select ("owned_adoptables", array("type"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$totalclicks $mysidia -> db -> select ("owned_adoptables", array("name"), "aid='{$adopt->aid}'") -> fetchColumn();
        
$tradestatus $mysidia -> db -> select ("owned_adoptables", array("tradestatus"), "aid='{$adopt->aid}'") -> fetchColumn(); 
Also you don't need to do so many database queries. You already have the adoptable as a private variable, it's an object that has all the information you need about it, go to class_ownedadoptable.php to check which functions you can use to get the values. That way you only do one database access, and not 5 or 6. For example to get the gender $this->adopt->getGender() and the tradestatus $this->adopt->getTradeStatus();
__________________


asp.net stole my soul.
Reply With Quote
  #3  
Old 05-04-2014, 05:11 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,758
Hwona is on a distinguished road
Default Re

Thank you so much! It worked! Err, I tried to do the same thing for the situation with a frozen adoptable and then link the click page to itself to refresh, but nothing is appearing.

PHP Code:
<?php

class LevelupController extends AppController{

    const 
PARAM "aid";
    private 
$view;
    private 
$subController;
    private 
$adopt;

    public function 
__construct(){
        
parent::__construct();
        
$mysidia Registry::get("mysidia");
        if(
$mysidia->input->action() == "click" or $mysidia->input->action() == "siggy"$this->adopt = new OwnedAdoptable($mysidia->input->get("aid"));
        if(
$mysidia->user instanceof Member){
            
$status $mysidia->user->getstatus();   
            if(
$status->canlevel == "no") throw new InvalidActionException($mysidia->lang->banned);
        }    
    }
    
    public function 
index(){
        
$mysidia Registry::get("mysidia");
        throw new 
InvalidActionException($mysidia->lang->global_action);
    }
    
    public function 
click(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();        
        
$date = new DateTime;
        
$ip secure($_SERVER['REMOTE_ADDR']);
        
$gender $this->adopt->getGender($fetchMode "");
        
$owner $this->adopt->getOwner();
        
$adoptablename $this->adopt->getName();
        
$totalclicks $this->adopt->getTotalClicks();
        
$tradestatus $this->adopt->getTradeStatus();
        
$currentlevel $this->adopt->getCurrentLevel(); 
        
$nextlevel $this->adopt->hasNextLevel();
        
$type $this->adopt->getType();
        
$image $this->adopt->getImage($fetchMode "");
        
$offspring $this->adopt->getOffsprings();
        
$lastbred $this->adopt->getLastBred($fetchMode "");
        
$levelupclicks $this->adopt->getLevelupClicks();
        
        
    
    
        if(
$this->adopt->hasVoter($mysidia->user$date)){
            
// The user has leveled up this adoptable today, show error message
                     
$message "<img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$this->adopt->getAdoptID()}'><br>
Name: 
{$adoptablename}<br>
Owner: 
{$owner}<br>
Species: 
{$type}<br>
Gender: <img src='
{$mysidia->path->getAbsolute()}picuploads/{$gender}.png'><br>
Total Clicks: 
{$totalclicks}<br>
Current Level: 
{$currentlevel}<br>
Next Level: 
{$nextlevel}<br>
Clicks to Next Level: 
{$levelupclicks}<br>
Trade Status: 
{$tradestatus}<br>
Number of Offspring: 
{$offspring}<br>
Last Bred: 
{$lastbred}<br>";
$message $message .= (($mysidia->user instanceof Member)?$mysidia->lang->already_leveled_member:$mysidia->lang->already_leveled_guest);
            
$document->setTitle($mysidia->lang->already_leveled_title);
            
$document->addLangvar($message);
        }
        elseif(
$this->adopt->isFrozen() == "yes"){
        
$message $message .= "<img src='{$mysidia->path->getAbsolute()}levelup/siggy/{$this->adopt->getAdoptID()}'><br>
Name: 
{$adoptablename}<br>
Owner: 
{$owner}<br>
Species: 
{$type}<br>
Gender: <img src='
{$mysidia->path->getAbsolute()}picuploads/{$gender}.png'><br>
Total Clicks: 
{$totalclicks}<br>
Current Level: 
{$currentlevel}<br>
Next Level: 
{$nextlevel}<br>
Clicks to Next Level: 
{$levelupclicks}<br>
Trade Status: 
{$tradestatus}<br>
Number of Offspring: 
{$offspring}<br>
Last Bred: 
{$lastbred}<br>";
            
$document->setTitle($mysidia->lang->frozen_title);
            
$document->addLangvar($mysidia->lang->frozen);
        }
        else{
        
$message $message .= "<a href='{$mysidia->path->getAbsolute()}levelup/click/{$this->adopt->getAdoptID()}'>Link text</a>";
            
$newClicks $this->adopt->getTotalClicks() + 1;
            
$this->adopt->setTotalClicks($newClicks"update");
            
$mysidia->db->insert("vote_voters", array("void" => NULL"date" => $date->format('Y-m-d'), "username" => $mysidia->user->username"ip" => $ip"adoptableid" => $mysidia->input->get("aid")));         
            
            if(
$this->adopt->hasNextLevel()){
                
// A higher level does exist, so we see if it is time to level up
                
$nextLevel $this->adopt->getNextLevel();
                
$requiredClicks $nextLevel->getRequiredClicks();
                if(
$requiredClicks and $newClicks >= $requiredClicks$this->adopt->setCurrentLevel($nextLevel->getLevel(), "update");
            }
            
            
$document->setTitle("{$mysidia->lang->gave} {$this->adopt->getName()} one {$mysidia->lang->unit}");
            
$reward $mysidia->user->clickreward($mysidia->settings->rewardmoney);
            
$mysidia->user->changecash($reward);            
            
$image $this->adopt->getImage("gui");        
            
$image->setLineBreak(TRUE);    
            
            
$summary = new Division;
            
$summary->setAlign(new Align("center"));
            
$summary->add($image);    
            
$summary->add(new Comment("{$mysidia->lang->gave}{$this->adopt->getName()} one {$mysidia->lang->unit}."));
            
$summary->add(new Comment($mysidia->lang->encourage));
            
$summary->add(new Comment("<br>"));
            
$summary->add(new Comment(" You have earned {$reward} {$mysidia->settings->cost} for leveling up this adoptable. "));
            
$summary->add(new Comment("You now have {$mysidia->user->getcash()} {$mysidia->settings->cost}"));
            
$document->add($summary);            
        }
    }

    public function 
siggy(){
        
$mysidia Registry::get("mysidia");
        
// The adoptable is available, let's collect its info
        
$usingimage "no";
        
$image $this->adopt->getImage(); 
      
        
$usegd $mysidia->settings->gdimages;
        
$imageinfo = @getimagesize($image);
        
$imagemime $imageinfo["mime"]; // Mime type of the image file, should be a .gif file...

        
if(function_exists('imagegif') and $usegd == "yes" and $imagemime == "image/gif"){
            
$usingimage "yes"//Turn the template system off
            
$type $this->adopt->getType();
            list(
$width$height$type$attr) = getimagesize($image); // The size of the original adoptable image

            // Lets create the new target image, with a size big enough for the text for the adoptable
            
$newheight $height 72;
            
$newwidth = ($newwidth 250)?250:$width;
            
$img_temp imagecreatetruecolor($newwidth$newheight); 
            
$alphablending true;  
         
            
// Lets create the image and save its transparency  
            
$img_old = @imagecreatefromgif($image);  
            
imagealphablending($img_oldtrue);  
            
imagesavealpha($img_oldtrue);
   
            
// Lets copy the old image into the new image with  
            
ImageCopyResampled($img_temp$img_old0000$width$height$width$height);    
            
$textheight $width 2;
            
$image $img_temp;
            
$bgi imagecreatetruecolor($newwidth$newheight);
            
$color imagecolorallocate($bgi515151);
         
            
// Build text for siggy
            
$str1 "Name: ".$this->adopt->getName();
            
$str2 "Owner: ".$this->adopt->getOwner();
            
$str3 "Click Here to Feed Me!";
            
$str4 "More Adopts at:";
            
$str5 "www.".constant("DOMAIN");

            
// Renger Image
            
imagestring ($image120$textheight,  $str1$color);
            
imagestring ($image120$textheight 13,  $str2$color);
            
imagestring ($image120$textheight 26,  $str3$color);
            
imagestring ($image120$textheight 42,  $str4$color);
            
imagestring ($image120$textheight 55,  $str5$color);
            
$background imagecolorallocate($image000);  
            
ImageColorTransparent($image$background);  
 
            
// At the very last, let's clean up temporary files
            
header("Content-Type: image/GIF");
            
ImageGif ($image);
            
imagedestroy($image);
            
imagedestroy($img_temp);
            
imagedestroy($img_old);
            
imagedestroy($bgi);

        }
        else{      
                
// We are going to try and get this image the old fashioned way...
            
$extList = array();
            
$extList['gif'] = 'image/gif';
            
$extList['jpg'] = 'image/jpeg';
            
$extList['jpeg'] = 'image/jpeg';
            
$extList['png'] = 'image/png';

            
//Define the output file type
            
$contentType 'Content-type: '.$extList$imageinfo['extension'] ];

            if(
$imageinfo['extension'] =! "image/gif" and $imageinfo['extension'] =! "image/jpeg" and $imageinfo['extension'] =! "image/png"){             
                throw new 
InvalidIDException("The file Extension is not allowed!");
            }
            else{
                
// File type is allowed, so proceed
                
$status "";
                
header($contentType);
                
$curl = new Curl($image);
                
$curl->setHeader();
                
$curl->exec();
                
$curl->close();
            } 
        }
    }
    
    public function 
daycare(){
        
$mysidia Registry::get("mysidia");
        
$document $mysidia->frame->getDocument();
        
$document->setTitle($mysidia->lang->daycare_title);
        
$document->addLangvar($mysidia->lang->daycareTRUE);
        
        try{
            
$daycare = new Daycare;
            
$adopts $daycare->getAdopts();
        }
        catch(
DaycareException $dae){
            
$message $dae->getmessage();
            
$document->addLangvar($mysidia->lang->{$message});
            return;
        }
        
        
$daycareTable = new Table("daycare"""FALSE);
        
$daycareTable->setBordered(FALSE);
        
$total $daycare->getTotalAdopts();
        
$index 0;

        for(
$row 0$row $daycare->getTotalRows(); $row++){
            
$daycareRow = new TRow("row{$row}");
            for(
$column 0$column $daycare->getTotalColumns(); $column++){
                
$adopt = new OwnedAdoptable($adopts[$index]);
                
$image = new Link("levelup/click/{$adopt->getAdoptID()}"$adopt->getImage("gui"), TRUE);
                
$stats = new Comment($daycare->getStats($adopt));
                
$daycareCell = new TCell(new ArrayObject(array($image$stats)), "cell{$index}");
                
$daycareCell->setAlign(new Align("center""center"));
                
$daycareRow->add($daycareCell);
                
$index++;
                if(
$index == $total) break;
            }
            
$daycareTable->add($daycareRow);            
        }
        
        
$document->add($daycareTable);
        if(
$pagination $daycare->getPagination()) $document->addLangvar($pagination->showPage());
    }
}

?>
__________________
Reply With Quote
  #4  
Old 05-04-2014, 05:50 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,374
IntoRain is on a distinguished road
Default

Glad it worked!

You need to add the message to the document/page, instead of
$document->addLangvar($mysidia->lang->frozen); you need to have $document->addLangvar($message);
__________________


asp.net stole my soul.
Reply With Quote
  #5  
Old 05-04-2014, 07:20 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,758
Hwona is on a distinguished road
Default Re

Okey dokey! Thank you again! Everything is up and running!
By any chance, do you know what the "last bred" numbers mean? :3
__________________
Reply With Quote
  #6  
Old 05-04-2014, 08:55 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,374
IntoRain is on a distinguished road
Default

I believe it's a unix timestamp. You can do this to format it to show a readable date

$dt = new DateTime( "@" . $this->adopt->getLastBred() );
$lastbred = $dt->format('Y-m-d');
__________________


asp.net stole my soul.
Reply With Quote
  #7  
Old 05-04-2014, 09:03 PM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,758
Hwona is on a distinguished road
Default Re

I think I'm done for now! Thanks again! - I think you've done most of the work for me. XP
__________________
Reply With Quote
  #8  
Old 05-06-2014, 07:14 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,758
Hwona is on a distinguished road
Default Re

Oops, one more thing! Now I'm getting an error with the datetime - frozen adoptables only: DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character
Do I need to edit the datetime to show 0 when the adoptable hasn't been bred? I can't seem to find it... XP

Edit: nevermind, I found a way to fix it, but I want to replace 1970-01-01 with 0
__________________

Last edited by Hwona; 05-06-2014 at 08:12 AM.
Reply With Quote
  #9  
Old 05-06-2014, 10:57 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,374
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by Wallie987 View Post
Oops, one more thing! Now I'm getting an error with the datetime - frozen adoptables only: DateTime::__construct(): Failed to parse time string (@) at position 0 (@): Unexpected character
Do I need to edit the datetime to show 0 when the adoptable hasn't been bred? I can't seem to find it... XP

Edit: nevermind, I found a way to fix it, but I want to replace 1970-01-01 with 0
Sorry didn't test it so didn't think of case 0!

What about
$lastbred = 0;//this way lastbred is always 0 if getLastBred() also returns 0
if($this->adopt->getLastBred() != 0){
$dt = new DateTime( "@" . $this->adopt->getLastBred() );
$lastbred = $dt->format('Y-m-d');
}
__________________


asp.net stole my soul.
Reply With Quote
  #10  
Old 05-07-2014, 07:40 AM
Hwona's Avatar
Hwona Hwona is offline
Member
 
Join Date: Mar 2013
Posts: 620
Gender: Female
Credits: 48,758
Hwona is on a distinguished road
Default Re

Yay! It works! :D
__________________
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
Editing Stats Page & Little Icon Glow Questions and Supports 4 12-07-2014 08:29 AM
Online list ... and a Stats Page for Players Missy Master Questions and Supports 2 07-07-2014 09:58 AM
Help Making Stats Page = Click Page & Lineages? squiggler Questions and Supports 2 02-22-2014 04:42 AM
Adoptable Stats Abronsyth Suggestions and Feature Requests 2 09-10-2011 02:28 PM
Random Adoptable Click page AlkseeyaKC Suggestions and Feature Requests 4 07-01-2011 02:49 PM


All times are GMT -5. The time now is 05:53 AM.

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