outputting a navigation menu

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
    I'm working on a new site and i'd like to have a navigation menu on it.  
Ideally i'm thinking:

first item
second item

obviously with different names. I could use echo to output each line, but i  
would rather use one echo statement combined with a for loop to get each  
item as in:

for ($x = 1; $x <= 3; $x++) {
echo "<li><a href='filename.php'> Item $x</a></li>";

and get the items from another point in the file or another file. I am  
uncertain how to do this. Am i overthinking this?

Re: outputting a navigation menu

Dave wrote:
Quoted text here. Click to load it

Hi, Dave,


The first question I would have is - why do you want this?  Because it's  
neat, or because you need dynamic menus?

Normally I try to keep my menus fairly constant - people come to expect  
this.  What I do change is submenus, i.e.

   Menu Item 1
   Menu Item 2
     Menu Item 2.1
     Menu Item 2.2
     Menu Item 2.3
   Menu Item 3
   Menu Item 4

Etc.  Expand the menu as necessary to get the submenu items.  Everything  
goes in one menu file which is included in the rest.

If I do truly need dynamic menu items, I use a database such as MySQL to  
store the info about each item as well as the criteria for displaying  
it.  A little more complicated to program, but over all easier to make  
changes in the menu items.

Beyond that, I'm not sure what you're asking.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline