Hello.
I have set up a php include navigation menu for my website. It works great, apart from on my subdirectories. I have include the file in these sub direcotries using:
Code: Select all
<?php include ('../includes/menu.inc.php');?>Code: Select all
<?php $currentpage = basename ($_SERVER ['SCRIPT_NAME']);?>
<ul>|
<li><a href="index.php" <?php if ($currentpage == 'index.php') { echo 'class="current"'; }?> >Home </a></li>|
<li><a href="services.php"<?php if ($currentpage == 'services.php') { echo 'class="current"'; }?> >Services</a> </li> |
<li><a href="website_design_hertfordshire.php"<?php if ($currentpage == 'website_design_hertfordshire.php') { echo 'class="current"'; }?> >Website Design</a> </li>|
<li><a href="ecommerce_websites_hertfordshire.php" <?php if ($currentpage == 'ecommerce_websites_hertfordshire.php') { echo 'class="current"'; } ?>>Ecommerce Solutions</a></li>|
<li><a href="portfolio.php" <?php if ($currentpage == 'portfolio.php') { echo 'class="current"'; }?>>Portfolio</a></li>|
<li><a href="quote.php" <?php if ($currentpage == 'quote.php') { echo 'class="current"'; }?>>Quotation</a></li>|
</ul>Is there anyway to get the script to recognise when it is being called in a sub directory? Any pointers in the right direction would be very much appreciated.
Regards,
Clare Green.
~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: