Hi folks!
I am attempting to build a PHP based menu for a site. I am a newbie and this is basically my first attempt at real PHP coding so bear with me.......
The structure of my site is as follows:
'index.php' contains an include that calls up 'menu.php'. The first issue is that I want the 'menu.php' code to call up an HTML page in yet another include located in the 'index.php' page. So if you are in my 'index.php' page it might look like this...
<DIV>
<?php
include 'menu.php';
?>
</DIV>
...so the navigation would affect the main content which would be in the same 'index.php' file....eg.
<DIV>
<?php
---main content here------
?>
</DIV>
Get it?!.....i hope so......
So here is the code I have currently for my 'menu.php' page. I am trying to make a menu that expands to show sublinks when a main link is clicked. So far it works great.....except....the main links or sublinks don't affect the main content area of the page. Also please look at the line comments in the following code to see the issues I am having with changing CSS classes when a link is active.
<!--menu-->
<?
echo"<a class=\"leftNavLarge\" href=\"index.php?page=homepage.html\">Home</a>";
//IF THE LINK BELOW IS CLICKED; I WANT TO CHANGE THE CSS CLASS OF THAT LINK
echo"<a class=\"leftNavLarge\" href=\"?sort=Reports\">Reports</a>";
function indexReports()
{
}
$choice=$_GET['sort'];
switch($choice)
{
// reports submenu
case "Reports":
//IF THE LINK BELOW IS CLICKED; I WANT TO CHANGE THE CSS CLASS OF THE RELEVANT LINK
echo "<a class=\"leftNavSmall\" href=\"index.php?page=wizReports.html\">Wizard Reports</a>";
echo "<a class=\"leftNavSmall\" href=\"index.php?page=standReports.html\">Standard Reports</a>";
echo "<a class=\"leftNavSmall\" href=\"index.php?page=trending.html\">Report Trending</a>";
echo "<a class=\"leftNavSmall\" href=\"index.php?page=images.html\">Bill Images</a>";
echo "<a class=\"leftNavSmall\" href=\"index.php?page=inserts.html\">Bill Inserts</a>";
break;// End reports submenu
}
?>
If there is anyone nice enough to help me I would be SOOOO grateful. Post any needs for clarification...and thank you in advance!