Re: How to recognize which 'case' is being echoed by switch statement
| From: | Daniel Brown | Date: | Fri, 22 Feb 2008 15:45:41 +0000 |
| Subject: | Re: How to recognize which 'case' is being echoed by switch statement | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44644@lists.php.net to get a copy of this message | ||
On Fri, Feb 22, 2008 at 6:01 AM, Tim Daff <timdaff@gmail.com> wrote:
> Hi,
>
> This is my first time using php in my site navigation, I have the code
> for all the pages in one file and I am using the switch statement to
> change between them.
[snip!]
None of your code included a case/switch piece. This is probably
what you mean:
<?
$page = basename($_SERVER['PHP_SELF']);
switch($page) {
case "contact.php":
$css = "<li id=\"contact-active\"></li>";
break;
case "portfolio.php":
$css = "<li id=\"portfolio-active\"></li>";
break;
case "whoweare.php":
$css = "<li id=\"whoweare-active\"></li>";
break;
default:
$css = "<li id=\"home-active\"></li>";
break;
}
?>
--
</Dan>
Daniel P. Brown
Senior Unix Geek
<? while(1) { $me = $mind--; sleep(86400); } ?>