Hi,
My navigation works like this:
$n = ( isset( $_GET['n'] ) ? $_GET['n'] : 0 );
$content = "";
switch ($n) {
default; case "1":
$content = "content for first page"
break;
case "2":
$content = "content for second page"
break;
etcetc
My navigation calls these:
a href="?n=1"
a href="?n=2"
and so on.
My problem is that I have a css based menu that highlights the specific page according to body class tag.
.page1 #navigation li#page1 a,
.page2 #navigation li#page2 a,
I wish there would be a way to define css to see these url endings ?n=1 , ?n=2 etc and define the menu highlight according to them instead of the body class names. But I think there isnt so I need to make the body tag change its class name onclick according to the url endigs. Would be great if someone could help me with this one. All I need to do is to get the menu highlights working...
I am not a very experienced php coder but was thinking about something like this to the body tag but could not get it working:
<body <?php if ($n=1) { ?>
class="page1"<?php } elseif($n=2) { ?>
class="page2"<?php } elseif($n=3) { ?>
class="page3"<?php } elseif($n=4) { ?>
class="page4"<?php } elseif($n=5) { ?>
class="page5"<?php } else{ ?>
class="page1"<?php echo $post->post_name; ?>"<?php } ?>>
its a mess, i know. Any ideas?
Thank you.
My navigation works like this:
$n = ( isset( $_GET['n'] ) ? $_GET['n'] : 0 );
$content = "";
switch ($n) {
default; case "1":
$content = "content for first page"
break;
case "2":
$content = "content for second page"
break;
etcetc
My navigation calls these:
a href="?n=1"
a href="?n=2"
and so on.
My problem is that I have a css based menu that highlights the specific page according to body class tag.
.page1 #navigation li#page1 a,
.page2 #navigation li#page2 a,
I wish there would be a way to define css to see these url endings ?n=1 , ?n=2 etc and define the menu highlight according to them instead of the body class names. But I think there isnt so I need to make the body tag change its class name onclick according to the url endigs. Would be great if someone could help me with this one. All I need to do is to get the menu highlights working...
I am not a very experienced php coder but was thinking about something like this to the body tag but could not get it working:
<body <?php if ($n=1) { ?>
class="page1"<?php } elseif($n=2) { ?>
class="page2"<?php } elseif($n=3) { ?>
class="page3"<?php } elseif($n=4) { ?>
class="page4"<?php } elseif($n=5) { ?>
class="page5"<?php } else{ ?>
class="page1"<?php echo $post->post_name; ?>"<?php } ?>>
its a mess, i know. Any ideas?
Thank you.