Jump to content


Photo

Menu advice


  • Please log in to reply
1 reply to this topic

#1 bach

bach
  • Members
  • PipPip
  • Member
  • 16 posts

Posted 04 October 2006 - 09:11 PM

Hello,

The following code is an example of the menu code contained on all the fundraising pages.

<ul>
<li><a href="../index.xhtml">Home</a></li>
<li><a href="../about/about.xhtml">About</a></li>
<li>Join Us</li>
<li>Outreach</li>
<li>News &amp; Events</li>
<li><a href="fund.xhtml">Fundraising</a></li>
<ul>
<li><a href="campaigns.xhtml">Current Campaigns</a></li>
<li>Help Us Raise Funds</li>
<li>Donations</li> </ul>
<li>Contact Us</li></ul>

My question is that on each page with a sub-menu like Fundraising I need to change the menu/sub-menu. Is it possible for me to write the whole menu and sub-menus and use php to check which submenus should be shown?

Bach

#2 tleisher

tleisher
  • Members
  • PipPipPip
  • Advanced Member
  • 88 posts

Posted 04 October 2006 - 09:30 PM

You could do something like this:

<?php

$fund = $_GET["fund"];

?>
<ul>
<li><a href="../index.xhtml">Home</a></li>
<li><a href="../about/about.xhtml">About</a></li>
<li>Join Us</li>
<li>Outreach</li>
<li>News &amp; Events</li>
<li><a href="fund.xhtml">Fundraising</a></li>
<?php

if($fund == "raiser_1"){
?>
<ul>
<li><a href="campaigns.xhtml">Fund Raiser #1</a></li>
<li>Help Us Raise Funds</li>
<li>Donations</li> </ul>
<li>Contact Us</li></ul>
<?php
} 
else if ($fund == "raiser_2")
{
?>
<ul>
<li><a href="campaigns.xhtml">Fund Raiser #2</a></li>
<li>Help Us Raise Funds</li>
<li>Donations</li> </ul>
<li>Contact Us</li></ul>
<?php
}
?>

Then use the URL: yoursite.php?fund=raiser_1 or yoursite.php?fund=raiser_2.. etc.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users