Jump to content

Dynamic Menu's


Kcarson

Recommended Posts

I am finally getting time to really devote to my site, and as I plan out the necessary steps I was wondering if someone could help me with this.On the home page will be a menu, such as:HomeReferencesCalendarPicturesContact UsEtc.Now when people go to each page, for instance Pictures, I want it to look like this:HomeReferencesCalendarPictures--Album 1--Album 2--Album 3--etc.Contact UsEtc.So, I had planned on using SSI's to do the menu so that it will be easy to maintain as the site grows, but do I need to create multiple SSI's for each page, or can I do this dynamically with PHP, ASP, or ASP.net? And if so, can sombody point me in the right direction?Thanks.

Link to comment
Share on other sites

If I think I know what you want---then you can use the php include() function, and keep a seperate php file for the menu---meaning, you only have to change the menu in one place.As for the other thing you wanted, you'd have to use SQL and put different choices under each main column/table, and build the menu according to what you pull out of the tables. :)PHP Tutorial: http://www.w3schools.com/sql/default.aspSQL Tutorial: http://www.w3schools.com/sql/default.aspGood luck and have fun!Choco

Link to comment
Share on other sites

If I think I know what you want---then you can use the php include() function, and keep a seperate php file for the menu---meaning, you only have to change the menu in one place.As for the other thing you wanted, you'd have to use SQL and put different choices under each main column/table, and build the menu according to what you pull out of the tables. :)PHP Tutorial: http://www.w3schools.com/sql/default.aspSQL Tutorial: http://www.w3schools.com/sql/default.aspGood luck and have fun!Choco

So you do just use SSI's and then in the SSI you would call the menu from a SQL table?I guess then I would have to do something like use if statements for each menu option to determine if I needed to show the sub-menu for that particular option.And use this kind of logic for each menu option?If that is the case, then I wouldn't actually have to use a SQL call, but I could just include the necessary pieces in the PHP/ASP code itself, but before I truly go down this path, I want to be sure there is not an easier way.By the way Chocolate570, you accidentally posted the same URL for PHP and SQL, but I know what you meant :)
Link to comment
Share on other sites

People are making this too complicated. You need to know HTML and CSS, and if you want to make things hard, Javascript. There is an article on A List Apart about them here: http://www.alistapart.com/articles/hybridJust edit the CSS a bit to make it vertical.

Ahh...I knew it wasn't that difficult. Thanks for the site, it looks like it should work like a charm. I will play around with it more later on, but I believe that it should be enough to help me get the menu section just right.
Link to comment
Share on other sites

or, I've taken what I think is an equally simple approach.

  • I start by cerating one SSI menu file.
  • On every page, I set a value at the top - <cfset section="xxxxxx">
  • In the menu SSI file, simply build the complete navigation menu - fully expanded
  • Then, in the menu SSI file, build a condition around each set of links that pertain to the respective section:
    Xxxxxxx Links<br><cfif section IS "xxxxxx">(all my links for that section)<br>(all my links for that section)<br>(all my links for that section)<br>(all my links for that section)<br><br></cfif>

  • Throw in a javascript that toggles the sections for extra measure if you like
  • Done!

Note: the same logic can be applied with any other server side scripting language.

Link to comment
Share on other sites

or, I've taken what I think is an equally simple approach.
  • I start by cerating one SSI menu file.
  • On every page, I set a value at the top - <cfset section="xxxxxx">
  • In the menu SSI file, simply build the complete navigation menu - fully expanded
  • Then, in the menu SSI file, build a condition around each set of links that pertain to the respective section:
    Xxxxxxx Links<br><cfif section IS "xxxxxx">(all my links for that section)<br>(all my links for that section)<br>(all my links for that section)<br>(all my links for that section)<br><br></cfif>

  • Throw in a javascript that toggles the sections for extra measure if you like
  • Done!

Note: the same logic can be applied with any other server side scripting language.

Ok, so it is an if statement checking to see what page you are on in order to decide which sub-menu to display. Makes enough sense. Let the fun begin now....(meaning now I can start whether it be with Shinta or Skemcin's method)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...