Jump to content


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


Hot to generate a dynmic navigation menue

Recommended Posts


i have a problem. I need to create a database driven navigation menue. I created a MySQL database. The table called "nav" has the following fileds: id, content, url. The plan is that all the content of the table is displayed as a navigation menue on the webpage and every single menue item is assigend the link, wich is given to it in the "url" field of the MySQL Database. I mean when I put in some more menue items in the database, menue on the webpage will disply the new menue item and is using the url assignet to the filed in the database.

i st up a page, in which the content of the navigation menue is generated by a MySQl request. The URL is


I have the problem how do i achiev that new items in the database are displayed with korrekt link on the webpage?


Is this possible to do?

And if yes how?

for any help very thankfull.


Cu Stephan

Share this post

Link to post
Share on other sites

Ok, first delete ALL of those recordsets you made, now, make one new recordset, called rs_nav, then select your connection. Now select the nav table. Under columns select all.

Now insert a repeating region for the nav section, deleting all but one of the 'global links'. make sure that it is a repeating region under server behaviors, and not under templates. Change the text 'global link', and put dynamic text there, making it content, and then select it and change it to a link, now make it a dynamic link by selecting the url field.


EDIT: if thats too complicated, I will make a easier to follow version, (with images).

Share this post

Link to post
Share on other sites

if you have the table for links with id, content (or link text), and url field, simply grab everything in the table, and loop through the results in your menu. then, use CSS to display everything like you want it. When a new link is added, it will just appear at the bottom of the menu:


$sql = "SELECT * FROM MenuTable";
$results = mysql_query($sql) or die();
echo "<ul id='nav'>\n"
while ($result = mysql_fetch_array($results)) {
   echo "<li><a href='".$result['url']."'>".$result['content']."</a></li>\n";
echo "</ul>\n";

that will give you all the links pointed to the right place in a nice unordered list, and all you have to do is apply a nice style sheet to get it to look right!

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.