Jump to content


Unordered list (using PHP and Javascript)

  • Please log in to reply
No replies to this topic

#1 sinsabit

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 22 May 2006 - 08:19 AM

hi guys,

I am using a menu on my site that uses html (unordered list - <ul>)
and javascript to make it dynamically unfold and fold up.

I am using a PHP include file (I've called menu.php) so that i do not have to re-edit the menu manually on each page every time i decide to add or change a menu item.

However, in the html porton of the code I need to insert an id tag (i have named "original") to identify which sub item sits open on a particular page eg. on offtravel.html, on the unordered list needs to look like this in the html;

<li id="original"><a href="../en/offtravel.html">Travel insurance</a></li>

so currently there are about 30 pages, 29 <li> tags and 1 <li id ="original"> tag, which needs to move up and down the code depending on which page is live.

given that I need this tag to appear in a different <li> on each page within its appropriate <li> tag, how can I write the include menu.php to perform this task for each page as it loads so that the correct level of menu sits open?

Here is the first portion of the html code that I have pulled into the include file.
<li><a href="#">Financial Controlling</a>
<li><a href="#">Cash controlling</a>
<li id="original"><a href="../en/budfor.html">Budgets and Forecasts</a></li>
<li><a href="../en/monper.html">Monitoring performance</a></li>
<li><a href="../en/restru.html">Restructuring</a></li>
<li><a href="#">Other controls</a>
<li><a href="../en/finind.html">Financial indicators</a></li>
<li><a href="../en/nonfin.html">Non Financial</a></li>
<li><a href="../en/marper.html">Market performance</a></li>


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users