tabbed navigation

M

mcnewsxp

i have setup css and am using <div><ul> <li> tags for my tabbed navigation.
i'd like to put the menu options in an include file. i have an <li
class="active">, but i don't know how to set the "active" page so i am hard
coding the menu in every page.
without asking me for a URL can someone tell me how to make this work.
tia,
mcnewsxp
 
A

Adrienne Boswell

i have setup css and am using <div><ul> <li> tags for my tabbed
navigation. i'd like to put the menu options in an include file. i
have an <li class="active">, but i don't know how to set the "active"
page so i am hard coding the menu in every page.
without asking me for a URL can someone tell me how to make this work.
tia,
mcnewsxp

You could do it server side. I do this all the time.

<?php
$thisurl = "contact.php";

?>
<div id="nav">
<ul>
<li><?php nav("index.php","Home",$thisurl) ?></li>
<li><?php nav("contact.php","Contact",$thisurl) ?></li>
<li><?php nav("about.php","About",$thisurl) ?></li>
</ul>
</div>

<?php funtion nav($uri,$page,$thisurl)

{

if($uri==$thisurl)
{echo "<a href='$uri' class='active'>$page</a>";}
else
{echo "<a href='$uri'>$page</a>";}
}
?>

}

Mine is actually a little more elaborate than that, but I think you get
the idea.
 
M

mcnewsxp

Adrienne Boswell said:
You could do it server side. I do this all the time.

<?php
$thisurl = "contact.php";

?>
<div id="nav">
<ul>
<li><?php nav("index.php","Home",$thisurl) ?></li>
<li><?php nav("contact.php","Contact",$thisurl) ?></li>
<li><?php nav("about.php","About",$thisurl) ?></li>
</ul>
</div>

<?php funtion nav($uri,$page,$thisurl)

{

if($uri==$thisurl)
{echo "<a href='$uri' class='active'>$page</a>";}
else
{echo "<a href='$uri'>$page</a>";}
}
?>

}

Mine is actually a little more elaborate than that, but I think you get
the idea.
--

that's what i'm looking for. mine will be classic ASP for this one tho.
i'll try and adapt you code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top