php look up page identity - for multiple possibilities

Hi,

I have installed a PHP snippet to look up the page ID so I can make a link “current” and change the look of the link using CSS.

This is the code I used for this link to become active (or, “Current”) if the page ID is “Apps”:

  • ">Apps

    I am wanting to make this link become active if the page ID is “Apps”, or “Other”, or “This one”, or “that one”. Is it possible for it to look up for several page IDs to trigger the active link?? If so, what is the syntax?

    Example: (this syntax is wrong… but illustrates what I want to do)

  • ">Apps

    Any help is greatly appreciated! Thank you very much in advance!

  • Regular old css can accomplish with that.

    Use $_GET

    [php]<li class="<?php echo ($_GET['id'] == "Apps" ? "active" : "");?>">Apps[/php]

    you could change the echo $page_id ==

    to a function eg

    replace the whole echo with page_id($id)

    and then above put the function

    [php]page_id($id){

    if($id == “active”){
    echo ‘active’;
    }
    if($id == “example”){
    echo ‘example’;
    }
    }[/php]

    Sponsor our Newsletter | Privacy Policy | Terms of Service