I am trying to create bold links in a menu depending on which page the visitor is currently on. I managed to get it working with the following code, but the problem is that my code has the possibility of sub-menus under options, so links may be:
index.php?page=category
index.php?page=category&subcategory=something
index.php?page=category&subcategory=somethingelse
The subcategories are working fine, but the problem is, I have no way of matching “index.php?page=category” because then both subcategories “something” and “somethingelse” also go bold.
Is there any way to match the exact string of “page=category” but no further?
<?
$urlstring = $_SERVER['QUERY_STRING'];
if (preg_match ("/page=category/i", $urlstring)) {
echo "<b>";
}
?>
Yeah just use
$_GET['page']Also, you might want to apply a class with boldness to whatever element you’re bolding rather than using
<b>(you have more control over the style, you could even alter the color)Cheers
-D