HTML CSS a:current

Soldato
Joined
3 Feb 2003
Posts
2,856
Location
Shropshire
Evening, help needed desperately as ive exhausted my skill set

I am creating a basic menu using <ul> <li> but i want to use a.current as a class to highlight the selected page i'm on.

Now - ive got it up and running for a absolute url but id like to use only a part url so anything within a directory and sub directories are highlighted too.

Anyone know if this is possible? I cant find any information as i am not quite even sure what im looking for. Some sort of wildcard for the url??

TIA
 
Soldato
OP
Joined
3 Feb 2003
Posts
2,856
Location
Shropshire
Yeah PHP

Code:
<{php}>  
$pageurl = getenv("REQUEST_URI"); 
 $GLOBALS['Tpl']->assign( 'pageurl', $pageurl); 
 <{/php}>

Code:
    <div id="nav" class="<{$pageurl}>">
      <ul>
        <li class="<{if $pageurl == "/"}>current<{/if}>"><a href="<{AppUrl }>">Home</a></li>

The problem lies if i select a page that is not an exact url. The link in the nav bar is not highlighted.

ie /news/index.php is highlighted but /news/page1.php isnt.
Id like everything in directory /news/ to be highlight in the navigation menu.


Make sense?
 
Soldato
OP
Joined
3 Feb 2003
Posts
2,856
Location
Shropshire
It will probably be something like:
.current ul li{ **highlighting code** }
So that you are selecting all of the sub items contained within the .current item. Depends on how your page is structured though.
Is it a live site that we can look at?

Sorry not a live site yet :( its not actually working yet
 
Back
Top Bottom