 |

Perchpole
User
Apr 2, 2008, 5:59 PM
Post #1 of 4
(572 views)
Shortcut
|
|
List Rows - Alternating Background Colours
|
Can't Post
|
|
Hi, Dave - I noticed that you'd recently given someone a little help configuring rows on a list page. It got me thinking about an issue that web designers often come up against when dealing with lists: namely, an expedient method for alternating the background colour of each row. I wondered if there was any trick in php that we could exploit to enable us to do this in CMS Builder?
AJ
|
|
|  |
 |

Dave
Staff
/ Moderator

Apr 2, 2008, 9:38 PM
Post #2 of 4
(568 views)
Shortcut
|
|
Re: [Perchpole] List Rows - Alternating Background Colours
[In reply to]
|
Can't Post
|
|
Here's a little shorthand PHP I often use:
<?php $bgColor = (@$bgColor == "#CCCCCC") ? '#EEEEEE' : '#CCCCCC'; ?> Just replace the '#CCCCCC' and '#EEEEEE' with the colors you want and put that just below the start of your foreach loop. Then you can print out the bgColor value like this:
bgcolor="<?php echo $bgColor; ?>" You could also use that to rotate a classname if you want to use CSS for your background color. Hope that helps! :) Dave Edis - Senior Developer interactivetools.com
|
|
|  |
 |

Perchpole
User
Apr 3, 2008, 3:53 PM
Post #3 of 4
(556 views)
Shortcut
|
|
Re: [Dave] List Rows - Alternating Background Colours
[In reply to]
|
Can't Post
|
|
Brilliant. Now you're just showing-off!
AJ
|
|
|  |
 |

DHester
User
Apr 7, 2008, 5:20 PM
Post #4 of 4
(529 views)
Shortcut
|
|
Re: [Perchpole] List Rows - Alternating Background Colours
[In reply to]
|
Can't Post
|
|
I used your alternating background color code also Dave. Thanks! Darren Hester www.designsbydarren.com
(This post was edited by DHester on Apr 7, 2008, 5:20 PM)
|
|
|  |
|