Support » Fixing WordPress » Quick php question

  • <?php if (basename($PHP_SELF)==index.php) $thisPage=”Origins”); ?>

    would this set the var $thispage to origins or am i missing some sort of punctuation?

Viewing 4 replies - 1 through 4 (of 4 total)
  • It’s not syntactically correct.

    <?php if (basename($PHP_SELF)=='index.php') $thisPage="Origins"; ?>

    You have an extra closing bracket.

    Ok thanks
    but i dont think this is setting the var.
    could i echo it so that it writes
    <?php $thispage="Origins"; ?>
    in to the document?

    Of course. Somewhere after your first bit of PHP code, put it in your template:

    <?php echo $thisPage; ?>

    Hrm.. well i’m not sure if its my coding thats buggered but with this its supposed to find out what the file name is, then if its index.php it sets the var to origins. Then My navigation reads this and puts in currentpage css styles to the link depending which page it is.
    This is the code for the links
    <li <?php if ($thisPage=="Origins")
    echo " id=\"currentpage\""; ?>><a href="index.php">Origins</a></li>

    arrgh.. i wish i knew more php programming this would make me bug you guys less

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Quick php question’ is closed to new replies.