Title: Quick php question
Last modified: August 18, 2016

---

# Quick php question

 *  [Chadwick](https://wordpress.org/support/users/chadwick/)
 * (@chadwick)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/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)

 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/quick-php-question/#post-173566)
 * It’s not syntactically correct.
 * `<?php if (basename($PHP_SELF)=='index.php') $thisPage="Origins"; ?>`
 * You have an extra closing bracket.
 *  Thread Starter [Chadwick](https://wordpress.org/support/users/chadwick/)
 * (@chadwick)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/quick-php-question/#post-173719)
 * 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?
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/quick-php-question/#post-173732)
 * Of course. Somewhere after your first bit of PHP code, put it in your template:
 * `<?php echo $thisPage; ?>`
 *  Thread Starter [Chadwick](https://wordpress.org/support/users/chadwick/)
 * (@chadwick)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/quick-php-question/#post-173820)
 * 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.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Chadwick](https://wordpress.org/support/users/chadwick/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/quick-php-question/#post-173820)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
