View Single Post
  #3  
Old 11-26-2013, 05:55 AM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 19,544
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by draugluin View Post

PHP Code:
 $gender = new TCell($adopt->getGender("gui"));
        if(
$currentlevel() == "0" $gender "Egg"); 
but it won't work.
It won't work for many reasons.

1) The if works like this:

PHP Code:
if(condition)
{
   do 
this;

2) $currentlevel is a variable, not a function (when you do this something() or something($stuff) or something($stuff, $stuff2) are functions).

3) "0" is a string, you probably want an integer, which is just 0.

4) $currentlevel even as a variable won't work, it's an empty variable. You must have meant $adopt->getCurrentLevel() which is a function that returns the current level of the object $adopt.

5) And this:
PHP Code:
$gender = new TCell($adopt->getGender("gui")) 
Gender is a TCell and below it you are saying it's a string ("Egg"). buildRow only accepts TCells. What you have to do is modify the getGender function so it outputs what you want (either images or strings). That function is associated with $adopt. So you have to see what the variable $adopt is.

PHP Code:
$adopt = new OwnedAdoptable($aid); 
You can see here, $adopt is an object/instance of the class OwnedAdoptable. That means that function is in the class_ownedadoptable file. In that file, you can see you have this variable visible to every function of that class:

PHP Code:
protected $currentlevel
Which can be used with $this->currentlevel.
Then go to the function

PHP Code:
public function getGender($fetchMode ""
And insert your condition there

PHP Code:
if($this->currentlevel == 0)
{
    return 
"Egg";

for example
(this in 1.3.3, not sure how if the newest version changed a lot...)
__________________


asp.net stole my soul.

Last edited by IntoRain; 11-26-2013 at 06:11 AM.
Reply With Quote