View Full Version : Breeding page is blank
RandomFrog
09-02-2013, 12:35 PM
I enabled breeding, but it just goes to a white screen whenever I try to go to the breeding page. Help?
:cfrown:
IntoRain
09-02-2013, 01:18 PM
Just in case, go to PhPMyAdmin, choose your Databse, and then _breeding_settings and check is system is enabled
Also, Blank page means Syntax error, did you mess around the Breeding files?
RandomFrog
09-02-2013, 01:37 PM
I didn't mess with any files at all. Yes, system is enabled in value, so I dunno what happened.
IntoRain
09-02-2013, 01:57 PM
That's really weird. Do you have the Breeding.php file? Can you post the code here?
Even if it was disabled, the page would appear anyway with a different content
edit: Was it working when you installed? If so, maybe reinstalling would help
RandomFrog
09-02-2013, 02:17 PM
Okay, here is the code:
<?php
class BreedingController extends AppController{
private $view;
private $subController;
public function __construct(){
parent::__construct("member");
$mysidia = Registry::get("mysidia");
$userStatus = $mysidia->user->getstatus();
if($userStatus->canbreed == "no") throw new NoPermissionException("It appears that you have been banned for breeding.");
}
public function index(){
$mysidia = Registry::get("mysidia");
$document = $mysidia->frame->getDocument();
$settings = new BreedingSetting($mysidia->db);
if($settings->system != "enabled") throw new InvalidActionException($mysidia->lang->system);
if($mysidia->input->post("submit")){
if($mysidia->input->post("female") == "none" or $mysidia->input->post("male") == "none"){
throw new InvalidIDException("You haven't selected a male or female adoptable.");
}
try{
$female = new OwnedAdoptable($mysidia->input->post("female"), $mysidia->user->username);
$male = new OwnedAdoptable($mysidia->input->post("male"), $mysidia->user->username);
$breeding = new Breeding($female, $male, $settings);
$validator = $breeding->getValidator("all");
$validator->validate();
}
catch(AdoptNotfoundException $ane){
throw new InvalidIDException("There is no adoptable that has that ID!");
}
catch(BreedingException $bre){
$status = $bre->getmessage();
$validator->setStatus($status);
throw new InvalidActionException($mysidia->lang->{$status});
}
if($settings->method == "advanced") $species = $breeding->getBabySpecies();
$breeding->getBabyAdopts($species);
$breeding->breed($adopts);
$num = $breeding->countOffsprings();
if($num > 0){
$document->setTitle("Breeding is Successful!");
$document->add(new Comment("Congratulations! Breeding is successful, you have acquired {$breeding->countOffsprings()} baby adoptables from the breeding center."));
$document->add(new Comment("Click on one of the links to see them!"));
$offsprings = $breeding->getOffsprings();
$offspringID = $mysidia->db->select("owned_adoptables", array("aid"), "1 ORDER BY aid DESC LIMIT 1")->fetchColumn() - $num + 1;
foreach($offsprings as $offspring){
$image = $offspring->getEggImage("gui");
$link = new Link("myadopts/manage/{$offspringID}", $image);
$document->add($link);
$offspringID++;
}
}
else{
$document->setTitle("Breeding has failed...");
$document->addLangvar(It did not work. Maybe you can try again!");
}
return;
}
$document->setTitle($mysidia->lang->title);
$document->addLangvar($mysidia->lang->default.$mysidia->lang->money);
$document->addLangvar("{$settings->cost} {$mysidia->settings->cost}");
$document->addLangvar($mysidia->lang->warning.$mysidia->lang->select);
$breedingForm = new Form("breedingform", "breeding", "post");
$current = new DateTime;
$lasttime = $current->getTimestamp() - (($settings->interval) * 24 * 60 * 60);
$stmt = $mysidia->db->select("owned_adoptables", array("aid"), "owner = '{$mysidia->user->username}' AND gender = 'f' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'");
if($stmt->rowcount() == 0) $document->addLangvar($mysidia->lang->female);
else{
$female = new DropdownList("female");
$femaleIDs = $stmt->fetchAll(PDO::FETCH_COLUMN);
$femaleNames = $mysidia->db->select("owned_adoptables", array("name"), "owner = '{$mysidia->user->username}' AND gender = 'f' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'")->fetchAll(PDO::FETCH_COLUMN);
$female->add(new Option("None Selected", "none"));
$female->fill($femaleNames, $femaleIDs);
$breedingForm->add(new Comment("Female: ", FALSE));
$breedingForm->add($female);
}
$stmt = $mysidia->db->select("owned_adoptables", array(), "owner = '{$mysidia->user->username}' AND gender = 'm' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'");
if($stmt->rowcount() == 0) $document->addLangvar($mysidia->lang->male);
else{
$male = new DropdownList("male");
$maleIDs = $stmt->fetchAll(PDO::FETCH_COLUMN);
$maleNames = $mysidia->db->select("owned_adoptables", array("name"), "owner = '{$mysidia->user->username}' AND gender = 'm' AND currentlevel >= {$settings->level} AND lastbred <= '{$lasttime}'")->fetchAll(PDO::FETCH_COLUMN);
$male->add(new Option("None Selected", "none"));
$male->fill($maleNames, $maleIDs);
$breedingForm->add(new Comment("Male: ", FALSE));
$breedingForm->add($male);
}
$breedingForm->add(new PasswordField("hidden", "breed", "yes"));
$breedingForm->add(new Button("Let's breed!", "submit", "submit"));
$document->add($breedingForm);
}
}
?>
It also WAS working when I installed it.
IntoRain
09-02-2013, 02:33 PM
This part:
else{
$document->setTitle("Breeding has failed...");
$document->addLangvar(It did not work. Maybe you can try again!");
}
addLangvar is missing a "
$document->addLangvar("It did not work. Maybe you can try again!");
Hall of Famer
09-02-2013, 02:47 PM
Well I am 100% sure you've modified the script at some point, 'cause this was what the line used to look like when you downloaded the files:
$document->setTitle("Breeding has failed...");
$document->addLangvar("This is too bad. Breeding is attempted but none of the baby adoptables have survived.");
Anyway just be careful next time, if you use an editor like notepad++ or an IDE like Netbeans, they should be able to tell you that you have messed up the syntax. A string needs to start and end with double/single quote, keep this in mind.
RandomFrog
09-02-2013, 09:35 PM
ahhh thank you so much! it works now.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.