Welcome Guest, Not a member yet? Register   Sign In
Conditional in $this->table->add_row()
#2

[eluser]cahva[/eluser]
No, you cant use the longhand version inside that. Just assign those to variables. Its much cleaner that way too:
Code:
$gender = ($p->gender == 1) ? 'Male' : 'Female';

switch ($p->age)
{
    case 0:
        $age = '17 and younger';
        break;
        
    case 1:
        $age = '18-25';
        break;
        
    default:
        $age = 'Old fart';
        break;
}

$this->table->add_row($gender,$age);


Messages In This Thread
Conditional in $this->table->add_row() - by El Forum - 12-21-2010, 12:26 AM
Conditional in $this->table->add_row() - by El Forum - 12-21-2010, 05:40 AM
Conditional in $this->table->add_row() - by El Forum - 12-22-2010, 02:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB