how to build a dynamic menu navigation?
Posted: 11 March 2008 04:56 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  03-06-2008

Another newbie question.  How would one build a menu tree dynamically?  So far, I see all the menu links are embedded in the templates.  I want something like root menu with submenus underneath.  And a user may later on add a page and can add it to any specific location of the menu tree.  Something on the line like Drupal.  Thanks in advance.

Profile
 
 
Posted: 11 March 2008 07:14 PM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRank
Total Posts:  2552
Joined  05-17-2002

There are a variety of approaches to this. EE doesn’t have a “menu builder” tool in the way that you’re thinking of. EE makes as little assumptions as possible as to how a user wants to use HTML. Generally speaking its better to build the menu however you want and then pull content into it.

Some people use EE’s categories as page tools, others the Pages Modules, and still others stick with the simple and straight-forward HTML inside an embedded template site wide. There are various ways to let the user add to the menu tools with each method, it just depends on your needs.

You might also take a look at Cocaholic’s Navigator Module which is like a more traditional menu builder for EE.

 Signature 
Profile
MSG
 
 
Posted: 11 March 2008 08:06 PM   [ Ignore ]   [ # 2 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1590
Joined  01-05-2007

Of course you can use entry titles as navigation too…

It would be best to let us know your desired structure and perhaps we can help out.

Have you looked at the other threads about navigation and structure?

 Signature 

 
Steven Hambleton | ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 12 March 2008 11:56 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  03-06-2008

Thanks.  The site will have a menu navigation very similar to EE home site.  My site will have 5 root-level menu items.  Each main menu item may be populated with a number of submenu items shown as drop-down.  The end-user will need to have the ability to create a new static page and the new page will be shown up as one of the specific submenu item.  Pretty standard CMS stuff.  Sorry but I don’t see it in the tutorials or documents about this stuff.

Profile
 
 
Posted: 12 March 2008 01:29 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Greetings, Arnold.  This is absolutely possible, but as mentioned above, there are many, many ways to handle this.  I would begin by creating a simple template with just your navigation items in it.  This way, you can embed that in other templates, making it easy to update down the road.

For allowing teh end-user to add a sub-navigation item, I would personally create a weblog for those navigation items, with each entry being a navigation item.  For instance, I have a weblog for Site Information.  In that I have these entries:

* About me
* About the site
* Privacy Policy

I can output on my page the full information for one.  But, I can also create a drop-down using this code:

<ul>
{exp:weblog:entries weblog="info" limit="10"}
<li><a href="{comment_url_title_auto_path}">{title}</a></li>
{/exp:weblog:entries}
</ul>

What this would do is link to those entries, and if your client added a new entry in this info weblog, it would automatically be added to your navigation.  You can use the Pages Module as well if you want to have a special URI for these pages.

So, as you can see, this is entirely possible.  If you do want more specific help with implementing this, I’d recommend downloading and trying EE and starting to build out your site, then posting in the How To forum where the community can assist you in building the navigation you want for your site. =)

 Signature 
Profile
MSG
 
 
Posted: 12 March 2008 04:27 PM   [ Ignore ]   [ # 5 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2411
Joined  12-06-2002

FWIW - I’ve posted a number of examples and tutorials around building navigation with EE.

 Signature 

Sign up for Southern Fried ExpressionEngine - a 4-day EE class in San Antonio, TX starting on January 20th.

Profile
 
 
Posted: 12 March 2008 05:09 PM   [ Ignore ]   [ # 6 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  03-06-2008

Thanks Lisa.  Using this approach, does it imply I should map one web blog to each root menu item.  I suppose I’ll need a custom field ‘Weight’ so the submenus can be displayed in order of user preference.  Since the back-end design is gearing toward publishing, it may not be very intuitive for user to change the order of the submenus like a traditional menu builder tool….

Profile
 
 
Posted: 12 March 2008 05:22 PM   [ Ignore ]   [ # 7 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32861
Joined  05-14-2004

Hi, Arnold - It is really impossible to say what you *should* do.  You may want to use categories for navigation, or the other methods mentioned above.  The root menus can be driven by different methodologies - there is no restriction, and no best practice.  It is what is best for your site.

At a deeper level, what needs to happen is sitting down and figuring out what your data is and how to best structure it within ExpressionEngine.  That may be driven by how you want navigation, or it may drive how your navigation appears.  I know you want clear answers, “what is the best way to do this” - but that is something you need to decide. =)

To add to that - for ordering of entries, check out the Reeorder module from http://expressionengine.com/wiki/Modules =)

 Signature 
Profile
MSG
 
 
Posted: 13 March 2008 11:40 AM   [ Ignore ]   [ # 8 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  03-06-2008

Thanks everyone.  I’ll check out the codes.  I think this is one area EE can really improve upon on.  I can foresee this can be a stumbling block for many EE newbies like myself.  It is nice to know that it can be done in so many ways, but at least it should provide one or two methods one can use right away, such as including Navigator module as part of the core modules.  Btw, Navigator doesn’t work for me since it doesn’t handle sub-category.  Otherwise, it is good for what it is.

Profile
 
 
Posted: 13 March 2008 11:43 AM   [ Ignore ]   [ # 9 ]  
Grad Student
Avatar
Rank
Total Posts:  100
Joined  03-06-2008
Michael Boyink - 12 March 2008 04:27 PM

FWIW - I’ve posted a number of examples and tutorials around building navigation with EE.

Your site is extremely helpful.  A great asset to EE community.  Particularly I like the ‘Building an EE site” series, very practical info.  Keep up the good work!

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64911 Total Logged-in Users: 38
Total Topics: 81859 Total Anonymous Users: 19
Total Replies: 440085 Total Guests: 192
Total Posts: 521944    
Members ( View Memberlist )