Re: How to recognize which 'case' is being echoed by switch statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 22, 2008 at 6:01 AM, Tim Daff <timdaff@xxxxxxxxx> 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); } ?>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux