So i'm trying to construct a function that does two things. Basically i'm trying to streamline some code that worked earlier but made the code too long and made me feel weird. I thought i'd try to slim it down a little bit. I'll paste the function here and describe what i'm trying to do with it after the paste. Unless you can tell what i'm trying to do w/o the explanation:
Code: Select all
<?php
$currentpage = basename($_SERVER['SCRIPT_NAME']);
$selected = "<span style=\"color: #a8c26e;\">";
if ($currentpage) {
echo $selected;
}
?>Code: Select all
<a href="index.php" <?php $currentpage == ('index.php'); ?>>Home</a>~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: