Re: Alternating Row Colors
I would be curious how you could add a style to a particular td using an array like that also. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Alternating Row Colors
This worked well but I wonder if there is an easier way to use the helper in just the tr tag itself. Ruby, for instance, uses a little 'cycle' scriptlet within the tag. Ex: %=cycle("white", "gray") I am just curious if it is possible without making the table info into an array. I found it pretty interesting that the commas in the TR array act as cells. Either way the solution below works fine. foreach ($data as $post): { $tr = Array ( $post['Post']['id'], $html->link($post['Post']['title'], "/posts/view/".$post['Post']['id']), $html->link('Delete',"/Posts/delete/{$output['Post']['id']}")." ".$html->link('Edit',"/Posts/edit/{$output['Post']['id']}"), $time->timeAgoInWords($post['Post']['created']) ); echo $html->tableCells($tr,Array('style'=>'background:#E2E2E2'),Array('style'=>'background:transparent')); } endforeach; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Alternating Row Colors
dangit, dangit, dangit..I need to research the helpers more.Thanks for the snippet, I will go back and recode the appropriate sections of my code.On 8/20/06, sicapitan <[EMAIL PROTECTED]> wrote: AD7 is right, tablecells does this automatically, and you can set theclaternating colours$html->tableCells($tr, array('style'=>'background:#E4E4E4'),array('style'=>'background:transparent')); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Alternating Row Colors
AD7 is right, tablecells does this automatically, and you can set the claternating colours $html->tableCells($tr, array('style'=>'background:#E4E4E4'), array('style'=>'background:transparent')); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Alternating Row Colors
Hi All, why not use the html helper for this, that's what the tableCells method seems to be for..? You can see an example here: http://wiki.cakephp.org/tutorials:i18n#messages_dynamic_content Note that if you have cake pre 3228, the count declaration in the html helper is incorrect and should be: static $count=0; HTH, AD7six --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Alternating Row Colors
I have been doing something something similar in my views. $row): ?>> I have the altRow class defined in my style sheet. On 8/19/06, c_doug <[EMAIL PROTECTED]> wrote: Can anyone tell me how to alternate row colors in CakePHP? Is itsimilar to doing it in regular PHP?Ex:$row_color = ($row_count % 2) ? $color1 : $color2;$row_count++; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---