Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Okay One more question XD (http://www.mysidiaadoptables.com/forum/showthread.php?t=4011)

Infernette 02-12-2013 06:52 AM

Okay One more question XD
 
Code:

elseif(!$mysidia->input->action()){
  // No action specified yet, show the default page for myadopts.php
  $mysidia->page->settitle($lang->title);
  $totaladopts = $mysidia->db->query("SELECT count(*) FROM ".constant("PREFIX")."owned_adoptables WHERE owner = '{$mysidia->user->username}'")->fetchColumn();
  $rowsperpage = 10;
  $pagination = new Pagination($totaladopts, $rowsperpage, "myadopts.php");
  $pagination->setPage($mysidia->input->get("page"));
 
  $stmt = $mysidia->db->join("adoptables", "adoptables.type = owned_adoptables.type")
                                          ->select("owned_adoptables", array(), constant("PREFIX")."owned_adoptables.owner = '{$mysidia->user->username}' ORDER BY ".constant("PREFIX")."owned_adoptables.totalclicks LIMIT {$pagination->getLimit()},{$rowsperpage}");
  $table = new Table("My Adopts", array("", "Name and Type", "Image", "Clicks", "Description"));       
  $mysidia->page->addcontent($table->getheader());
 
  while($adopt = $stmt->fetchObject()){
      $level = $mysidia->db->select("levels", array("primaryimage", "alternateimage", "description"), "adoptiename='{$adopt->type}' AND thisislevel='{$adopt->currentlevel}'")->fetchObject();
          if($adopt->currentlevel == 0) $image = $adopt->eggimage;
          elseif($adopt->usealternates == 'yes') $image = $level->alternateimage;
          else $image = $level->primaryimage;
         
          $table->buildtable(array("<img src='picuploads/{$adopt->gender}.png'>", "<em>{$adopt->name}</em> the {$adopt->type}", "<a href='myadopts.php?action=manage&id={$adopt->aid}'><img src='{$image}'></a>", $adopt->totalclicks, $level->description), "center");
          $mysidia->page->addcontent($table->showtable());         
  }
 
  $mysidia->page->addcontent($table->endtable());
  $mysidia->page->addcontent("<br /><br />{$pagination->showPage()}</div>"); 
}

For some reason it refuses to show the description I have set. Instead, it gives me a blank description column on the myadopts page.
The column is supposed to be there... The blankness, not so much XD
http://www.iaza.com/work/130213C/iaza13908934338900.png
http://www.iaza.com/work/130213C/iaza13908946877000.png
:eye:

I swear I think this hates me. XD

Empress_Swanbottom 02-12-2013 02:00 PM

I'm not positive as I haven't done this before, but perhaps you need to add the description after $level->description. Like...
$level->description="A soft blue egg"

Or perhaps without the equals sign? I'm not sure, but I hope this helps.

Isura 02-12-2013 04:04 PM

PHP Code:

$table->buildtable(array("<img src='picuploads/{$adopt->gender}.png'>""<em>{$adopt->name}</em> the {$adopt->type}""<a href='myadopts.php?action=manage&id={$adopt->aid}'><img src='{$image}'></a>"$adopt->totalclicks"{$level->description}"), "center"); 

I'm not sure, but maybe try to write "{$level->description}" instead of $level->description.This might be necessary, because your description is a text and not only a number like 'Clicks'.

Infernette 02-12-2013 04:22 PM

Swan, I'm trying to get it to do it for each adoptable and not just one, so I doubt that would work well.

Isuara, tried it, to no avail :s I'm on 1.3.2 so it might be that. I dunno, I'm quite lost at this o.o

Isura 02-12-2013 04:55 PM

That is strange. I tried it myself with 1.3.2 and it worked fine:

http://img688.imageshack.us/img688/2599/testhbc.png

//edit: removed the wrong code

Maybe you make somewhere a typing error?

Infernette 02-12-2013 05:32 PM

I tired what you supplied but it gives me the error
Parse error: syntax error, unexpected T_ELSEIF in /home/infern/public_html/myadopts.php on line 27
Do you have your entire myadopts page with that? Maybe it's something with my page down lower...

Isura 02-12-2013 05:41 PM

Quote:

Parse error: syntax error, unexpected T_ELSEIF in /home/infern/public_html/myadopts.php on line 27
That might be my bad. I had edit something else in my myadopts.php. But now I used the original one and only added the description part:

PHP Code:

<?php

require("inc/init.php");

//***************//
//  START SCRIPT //
//***************//

if(!$mysidia->user->isloggedin){
   
// The user is not logged in, show generic login error message
   
$mysidia->displayerror("guest");
}
elseif(!
$mysidia->input->action()){
   
// No action specified yet, show the default page for myadopts.php
   
$mysidia->page->settitle($lang->title);
   
$totaladopts $mysidia->db->query("SELECT count(*) FROM ".constant("PREFIX")."owned_adoptables WHERE owner = '{$mysidia->user->username}'")->fetchColumn();
   
$rowsperpage 10;
   
$pagination = new Pagination($totaladopts$rowsperpage"myadopts.php");
   
$pagination->setPage($mysidia->input->get("page"));
   
   
$stmt $mysidia->db->join("adoptables""adoptables.type = owned_adoptables.type")
                       ->
select("owned_adoptables", array(), constant("PREFIX")."owned_adoptables.owner = '{$mysidia->user->username}' ORDER BY ".constant("PREFIX")."owned_adoptables.totalclicks LIMIT {$pagination->getLimit()},{$rowsperpage}");
   
$table = new Table("My Adopts", array("""Name and Type""Image""Clicks","Description"));    
   
$mysidia->page->addcontent($table->getheader());
  
   while(
$adopt $stmt->fetchObject()){
      
$level $mysidia->db->select("levels", array("primaryimage""alternateimage","description"), "adoptiename='{$adopt->type}' AND thisislevel='{$adopt->currentlevel}'")->fetchObject();
      if(
$adopt->currentlevel == 0$image $adopt->eggimage
      elseif(
$adopt->usealternates == 'yes'$image $level->alternateimage
      else 
$image $level->primaryimage;
      
      
$table->buildtable(array("<img src='picuploads/{$adopt->gender}.png'>""<em>{$adopt->name}</em> the {$adopt->type}""<a href='myadopts.php?action=manage&id={$adopt->aid}'><img src='{$image}'></a>"
      
$adopt->totalclicks,"{$level->description}"), "center");
      
$mysidia->page->addcontent($table->showtable());      
   }
   
   
$mysidia->page->addcontent($table->endtable());
   
$mysidia->page->addcontent("<br /><br />{$pagination->showPage()}</div>");   
}
elseif(
$mysidia->input->get("id") and !is_numeric($mysidia->input->get("id"))){
   
// The user has entered a non-numeric adoptable id, show error message
   
$mysidia->displayerror("id");
}
else{
   
// The user has entered a valid adoptable id, let's check available actions to perform
   
$adopt $mysidia->db->select("owned_adoptables", array(), "owner='{$mysidia->user->username}' and aid='{$mysidia->input->get("id")}'")->fetchObject();      
   if(!
is_object($adopt)){
      
// The adoptable does not exist, show generic error message
      
$mysidia->displayerror("id");
   }
   elseif(
$mysidia->input->action() == "manage"){
      
$image getcurrentimage($adopt->aid);
      
$links "<img src='{$image}'><br /><br />This page allows you to manage {$adopt->name}.  Click on an option below to change settings.<br /><br />
                                    <b><a href='levelup.php?id=
{$mysidia->input->get("id")}'><img src='templates/icons/add.gif' border=0> Level Up {$adopt->name}</a><br />
                                    <a href='myadopts.php?action=stats&id=
{$mysidia->input->get("id")}'><img src='templates/icons/stats.gif' border=0> Get Stats for {$adopt->name}</a><br />
                                    <a href='myadopts.php?action=bbcode&id=
{$mysidia->input->get("id")}'><img src='templates/icons/bbcodes.gif' border=0> Get BBCodes / HTML Codes for {$adopt->name}</a><br />
                                    <a href='myadopts.php?action=rename&id=
{$mysidia->input->get("id")}'><img src='templates/icons/title.gif' border=0> Rename {$adopt->name}</a><br />
                                    <a href='myadopts.php?action=trade&id=
{$mysidia->input->get("id")}'><img src='templates/icons/trade.gif' border=0> Change Trade Status {$adopt->name}</a><br />
                                    <a href='myadopts.php?action=freeze&id=
{$mysidia->input->get("id")}'><img src='templates/icons/freeze.gif' border=0> Freeze or Unfreeze {$adopt->name}</a><br />
                                    <a href='myadopts.php?action=pound&id=
{$mysidia->input->get("id")}'><img src='templates/icons/delete.gif' border=0> Pound {$adopt->name}</a></b>";
      
$mysidia->page->settitle("Managing {$adopt->name}");
      
$mysidia->page->addcontent($links);   
   }
   elseif(
$mysidia->input->action() == "stats"){ 
      
$image getcurrentimage($adopt->aid);
      
$nextlevelexists getnextlevelexists($adopt->type$adopt->currentlevel);
      
      if(!
$nextlevelexists$nloutput $lang->maximum;
      else{
         
$nextlevel $adopt->currentlevel 1;
         
$nextclicks $mysidia->db->select("levels", array("requiredclicks"), "adoptiename='{$adopt->type}' and thisislevel='{$nextlevel}'")->fetchColumn();
          
$ctg $nextclicks $adopt->totalclicks;
         
$nloutput $nextlevel.$lang->clicks.$ctg;               
      }
      
      
$mysidia->page->settitle($adopt->name.$lang->stats);
      
$adoptstats "<img src='{$image}'><br /><br />
                     <b>Total Clicks: 
{$adopt->totalclicks}<br />
                     Gender: <img src='picuploads/
{$adopt->gender}.png'><br />
                     Trade Status: 
{$adopt->tradestatus}<br />
                     Current Level: 
{$adopt->currentlevel}<br />
                     Next Level: 
{$nloutput}<br /></b>
                     <h2>
{$adopt->name}'s Voters:</h2><br />{$lang->voters}<br /><br />";
      
$mysidia->page->addcontent($adoptstats);

      
$table = new Table("My Adopts", array("Username""Date Voted""Profile""PM"));
      
$mysidia->page->addcontent($table->getheader());
      
      
$stmt $mysidia->db->select("vote_voters", array(), "adoptableid='{$adopt->aid}' ORDER BY date DESC LIMIT 10");
      while(
$voter $stmt->fetchObject()) {
         if(empty(
$voter->username)) $voter->username "Guest";
         
$tablecontent = ($voter->username == "Guest")?
                          array(
"Guest"$voter->date"N/A""N/A"):
                          array(
$voter->username$voter->date"<a href='profile.php?user={$voter->username}' target='_blank'><img src='templates/buttons/profile.gif' border=0></a>""<a href='messages.php?action=newpm&user={$voter->username}' target='_blank'><img src='templates/buttons/pm.gif' border=0></a>");
         
$table->buildtable($tablecontent"center");
         
$mysidia->page->addcontent($table->showtable());
      }
      
$mysidia->page->addcontent($table->endtable());
   }
   elseif(
$mysidia->input->action() == "bbcode"){
      
$forumcode "{$lang->bbcode_info}<br /><p><u>Forum Codes / BBCode: </u></p><p><textarea name='textarea' cols='50' rows='4'>
                    [url=http://www."
.constant("DOMAIN").constant("SCRIPTPATH")."/levelup.php?id={$adopt->aid}][img]http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/siggy.php?id={$adopt->aid}[/img][/url]</textarea></p>";
      
$altcode = ($mysidia->settings->usealtbbcode == "yes")?"<p><u>Alternate BBCodes (Use if the above do not work on a forum): </u></p><p><textarea name='textarea' cols='50' rows='4'>
                 [url=http://www."
.constant("DOMAIN").constant("SCRIPTPATH")."/levelup.php?id={$adopt->aid}][img]http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/get/{$adopt->aid}.gif\"[/img][/url]</textarea></p>":"";                
      
$htmlcode "<p><u>HTML Code</u>:</p><p><textarea name='textarea' cols='50' rows='4'><a href=\"http://www.".constant("DOMAIN").constant("SCRIPTPATH")."/levelup.php?id={$adopt->aid}\" target=\"_blank\">
                  <img src=\"http://www."
.constant("DOMAIN").constant("SCRIPTPATH")."/siggy.php?id={$adopt->aid}\" border=0></a></textarea></p>";
      
$mysidia->page->settitle($lang->bbcode.$adopt->name); 
      
$mysidia->page->addcontent($forumcode.$altcode.$htmlcode);      
   }
   elseif(
$mysidia->input->action() == "rename"){
      
$image getcurrentimage($adopt->aid);
      if(!
$mysidia->input->post("adoptname")){
         
$renameform "<img src='{$image}'><br />{$lang->rename_default}{$adopt->name}{$lang->rename_details}<br />
                        <form name='form1' method='post' action='myadopts.php?action=rename&id=
{$adopt->aid}'><p>Adoptable Name: 
                        <input name='adoptname' type='text' id='adoptname'>
                        <input name='id' type='hidden' id='id' value='
{$adopt->aid}'>
                        <input name='action' type='hidden' id='action' value='rename'>
                        </p><p><input type='submit' name='Submit' value='Rename Adoptable'></p></form>"
;
         
$mysidia->page->settitle($lang->rename.$adopt->name);
         
$mysidia->page->addcontent($renameform);
      }
      else{
         
$poundpet $mysidia->db->select("pounds", array(), "aid='{$mysidia->input->post("id")}'")->fetchObject();
         if(!empty(
$poundpet->firstowner) and $mysidia->user->username != $poundpet->firstowner){
            
$mysidia->page->settitle($lang->rename_error);
            
$mysidia->page->addcontent($lang->rename_owner);               
         }
         else{                        
            
$mysidia->db->update("owned_adoptables", array("name" => $mysidia->input->post("adoptname")), "aid='{$mysidia->input->post("id")}' and owner='{$mysidia->user->username}'");
            
$mysidia->page->settitle($lang->rename_success_title);
            
$message "<img src='{$image}'><br />{$lang->rename_success}{$mysidia->input->post("adoptname")}
                        You can now manage 
{$mysidia->input->post("adoptname")} on the <a href='myadopts.php?action=manage&id={$mysidia->input->post("id")}'>My Adopts</a> page";
            
$mysidia->page->addcontent($message);
         }
      }
      
// End of the rename feature
   
}
   elseif(
$mysidia->input->action() == "trade"){
      
$image getcurrentimage($adopt->aid);
      
$mysidia->page->settitle($lang->trade);
      
      if(
$mysidia->input->get("confirm") == "yes"){
         switch(
$adopt->tradestatus){
            case 
"fortrade":
               
$mysidia->db->update("owned_adoptables", array("tradestatus" => 'notfortrade'), "aid='{$adopt->aid}' and owner='{$mysidia->user->username}'");
               
$message $lang->trade_disallow;
               break;
            case 
"notfortrade":
               
$mysidia->db->update("owned_adoptables", array("tradestatus" => 'fortrade'), "aid='{$adopt->aid}' and owner='{$mysidia->user->username}'");
               
$message $lang->trade_allow;
               break;
            default:
               
$message $lang->global_action;
         }
      }
      else{
         
$message "Are you sure you wish to change the trade status of this adoptable?
                     <center><b><a href='myadopts.php?action=trade&id=
{$adopt->aid}&confirm=yes'>Yes I'd like to change its trade status</a></b><br /><br />
                     <b><a href='myadopts.php'>Nope I change my mind! Go back to the previous page.</a></b></center><br />"
;                 
      }
      
$mysidia->page->addcontent($message);    
   }
   elseif(
$mysidia->input->action() == "freeze"){
      
$image getcurrentimage($adopt->aid);
      
$mysidia->page->settitle($lang->freeze);
      if(!
$mysidia->input->get("freeze")){
         
$status = ($adopt->isfrozen == "yes")?"<img src='templates/icons/freeze.gif'> Frozen<br />":"<img src='templates/icons/unfreeze.gif'> Not Frozen<br />";
         
$go = ($adopt->isfrozen == "yes")?"<a href='myadopts.php?action=freeze&id={$adopt->aid}&freeze=no'><img src='templates/icons/unfreeze.gif' border=0> Unfreeze This Adoptable</a>":"<a href='myadopts.php?action=freeze&id={$adopt->aid}&freeze=yes'><img src='templates/icons/freeze.gif' border=0> Freeze This Adoptable</a>";
         
$options "<img src='{$image}'><br /><b>{$adopt->name}'s Current Status: {$status}</b><br />
                     
{$lang->freeze}<br /><br /><b>{$go}</b><br /><br />{$lang->freeze_warning}";
         
$mysidia->page->addcontent($options);
      }     
      else{
         
// We are actually freezing or unfreezing the adopt...
         
switch($mysidia->input->get("freeze")){
            case 
"yes":
               
$frz "yes";
               
$message $adopt->name.$lang->freeze_success;
               break;
            case 
"no":
               
$frz "no";
               
$message $adopt->name.$lang->freeze_reverse;
               break;
            default:
               throw new 
Exception("Invalid action specified...");            
         }
         
$mysidia->db->update("owned_adoptables", array("isfrozen" => $frz), "aid='{$mysidia->input->get("id")}' and owner='{$mysidia->user->username}'");
         
$message .= "You may now manage {$adopt->name} on the <a href='myadopts.php?action=manage&id={$mysidia->input->get("id")}'>My Adopts</a> page";         
         
$mysidia->page->addcontent($message);
      }
   }
   elseif(
$mysidia->input->action() == "pound"){
      
$image getcurrentimage($adopt->aid);
      
      if(
$mysidia->input->get("confirm") == "yes"){
         
$poundadopt = new Pound($adopt->aid"pound");
         if(
$poundadopt->settings->system->active == "no"){
            
$mysidia->page->settitle($lang->global_action_title);
               
$mysidia->page->addcontent($lang->pound_disabled);                 
         }
         elseif(
$poundadopt->validate() == TRUE){
            
$poundadopt->dopound();
            
$mysidia->page->settitle($lang->pound_complete); 
            
$mysidia->page->addcontent($poundadopt->message);
         }
         else{
            
$mysidia->page->settitle($lang->global_error); 
            
$mysidia->page->addcontent($poundadopt->message);      
         }
      }
      else{
         
$mysidia->page->settitle("Pound Adoptables");
         
$options "<img src='{$image}'><br />{$lang->pound}<br /><br />{$lang->pound_warning}<br /><br />
                                        <center><b><a href='myadopts.php?action=pound&id=
{$mysidia->input->get("id")}&confirm=yes'>
                                        <img src='templates/icons/delete.gif' border=0> Pound 
{$adopt->name} - I dont want it anymore! 
                                        <img src='templates/icons/delete.gif' border=0></a></b><br /><br />
                                        <b><a href='myadopts.php'><img src='templates/icons/yes.gif' border=0> 
                                        DO NOT Pound 
{$adopt->name}! <img src='templates/icons/yes.gif' border=0></a></b></center><br />";
         
$mysidia->page->addcontent($options);                                
      }
   }
   else{
      
// Invalid action specified, show generic error message
      
$mysidia->displayerror("action");
   }
}

//***************//
//  OUTPUT PAGE  //
//***************//

$mysidia->output(); 

?>

Maybe it'll work for you now

Infernette 02-12-2013 05:52 PM

Okay, that worked :D
I have no idea what was going wrong with my side of it, but now it works :p

Isura 02-12-2013 06:14 PM

sometimes php is a big mysterium :D

I'm glad, that it worked for you now.

Hall of Famer 02-12-2013 09:03 PM

umm what is this about? You are trying to add a description column for each level?


All times are GMT -5. The time now is 02:57 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.