Jump to content

Archived

This topic is now archived and is closed to further replies.

bach

Menu advice

Recommended Posts

Hello,

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

[code]
<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>[/code]

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

Share this post


Link to post
Share on other sites
You could do something like this:

[code]
<?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
}
?>
[/code]

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.