sinsabit Posted May 22, 2006 Share Posted May 22, 2006 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.<ul> <li><a href="#">Financial Controlling</a> <ul> <li><a href="#">Cash controlling</a> <ul> <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> </ul> </li> <li><a href="#">Other controls</a> <ul> <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> </ul> </li> </ul> </li></ul>Thanks Quote Link to comment https://forums.phpfreaks.com/topic/10168-unordered-list-using-php-and-javascript/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.