Almeister9
Members
-
Joined
-
Last visited
Reputation Activity
-
Almeister9 got a reaction from JordanC in TUTORIAL: php include menuThis is a great method, and I use it often on many sites that I have designed.
It does tend to fall down though when you use parameters on php pages
e.g. beer.php?country=au
If you have a navigation menu where you wish to have a class of 'current' on all the beer.php pages, then:
<?php if (basename($_SERVER["REQUEST_URI"]) == "beer.php") echo " class='current' ";?>
will not work, as you are on a page called beer.php?country=au or a page called beer.php?country=jp etc.
however, if, for pages with parameterised file names like above, you use this code:
<?php if (basename($_SERVER['SCRIPT_NAME']) == "beer.php") echo " class='current' ";?>
This will give you a class of 'current' for all pages called beer.php irrespective of the parameters following it.
I hope this helps someone out there, and again thanks for the great method.
Cheers, Al.