By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,083 Members | 1,957 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,083 IT Pros & Developers. It's quick & easy.

outputting a navigation menu

P: n/a
Hello,
I'm working on a new site and i'd like to have a navigation menu on it.
Ideally i'm thinking:

home
first item
second item
etc

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?
Thanks.
Dave.
Dec 17 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Dave wrote:
Hello,
I'm working on a new site and i'd like to have a navigation menu on it.
Ideally i'm thinking:

home
first item
second item
etc

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?
Thanks.
Dave.
Hi, Dave,

Maybe.

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.
js*******@attglobal.net
==================

Dec 17 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.