rtanz wrote:

> how can i recreate scaffolding's use of alternating row colour in the
> list views? they seem to disappear when i bake the views


Just do the following, cakephp has a built in function for alternating
color rows, but fails when any advanced displaying is applied. Follow
my form below for advanced sorting that allows rows to be highlited
when conditions are met

<!</tr  above this goes the header info!>
<?php $altcolor = '1';?>
<!foreach ($index_name as $model_name): !>
<?php
$status1 = ($tracking['Tracking']['modified']); //MUST CHANGE THIS
        if ($status1 == 1) //must be a checkbox value of 0/1 in this case
                {//if statement A1 !!!!!!!!!!!!!!
                $status = 'Yes';//modifies displayed value
?>
<tr bgcolor="blue">
<! below here goes <td table start>

<! above here goes </td table end>
</tr>
<?php
                if ($altcolor == 1)
                        {$altcolor = '2';}
                        if ($altcolor == 0)
                        {$altcolor = '3';}
                }//if statement A1 !!!!!!!!!!!!
        if ($altcolor == 0) //must be a checkbox value of 0/1 in this cas
                {//if statement A2 @@@@@@@@@@@@@@
                $status = 'No';
?>
<tr bgcolor="white">
<! below here goes <td table start>

<! above here goes </td table end>
</tr>
<?php
$altcolor = '4';
                }//if statement A2 @@@@@@@@@@@@@@
if ($altcolor == 1)
        {//if statement A3 #############
        $status = 'No';
?>
<tr bgcolor="#C6DEFF">
<! below here goes <td table start>

<! above here goes </td table end>
</tr>
<?php
$altcolor = '5';
        }//if statement A3 #############
if ($altcolor == 2)
{ $altcolor = '0';
}
if ($altcolor == 3)
{ $altcolor = '1';
}
//this is not the prettiest method, but it allows for more then one
highlighted row
//to be selected without re-writing all of the logic
if ($altcolor == 4)
{ $altcolor = '1';
}
if ($altcolor == 5)
{ $altcolor = '0';
}
?>
<?php endforeach; ?>
</table>
</div>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to