Re: Cell Colour Change!!! HELP

From: Date: Fri, 07 Nov 2003 18:12:36 +0000
Subject: Re: Cell Colour Change!!! HELP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-168879@lists.php.net to get a copy of this message
Hi I had somthing like the following in my code which almost works but code use debugging! <tr bgcolor=" <? IF(?page!="home") { print("#006633") ; } elseif (?page!="compose") { print("#009966") ; } elseif (?page!="Registration") {print("#CC0033") ;}"> <td><td/> <tr/> But what would happen a totally different colour would show In the above example would I assing the variable as such <tr bgcolor="$color"> "Lowell Allen" <la@lowellallen.com> wrote in message news:BBD12FAA.722B%la@lowellallen.com... > > I have a cell in my view.php which shows up in all my pages of my site. This > > is wha tI need to do: > > > > If the user is on the home page(index.php) then the cell colour should be > > blue. > > If the user is on the compose page(compose.php) then the cell colour should > > be green > > If the user in on the registration page then the colour should red > > and if the user is on the contac us then the color of thecell should be > > yellow! > > > > Can some one point me to an example or provide me with a basic php code > > structure to work with. > > You could check the name of the current page and set a variable for the cell > color accordingly. Something like: > > if (eregi("index", $PHP_SELF)) { > $color = "blue"; > } elseif (eregi("compose", $PHP_SELF)) { > $color = "green"; > } elseif (eregi("register", $PHP_SELF)) { > $color = "red"; > } elseif (eregi("contact", $PHP_SELF)) { > $color = "yellow"; > } else { > $color = ""; > } > > HTH > > -- > Lowell Allen

« previous php.general (#168879) next »