Dynamic Sub Navigation through Categories and Pages
Posted: 16 May 2008 03:28 PM   [ Ignore ]  
Summer Student
Total Posts:  1
Joined  2008-05-14

Hello,

First, I’d like to express how frustrating my experience has been with ExpressionEngine Commercial. The learning curve is worse than Drupal and your documentation needs work. Therefore, the last few days of integration have been peculiar because I am use to CodeIgniter’s fantastic documentation.

Second, your static page management is weird by comparison of what else is out there. I do see that LG is writing a module and I hope this is also simplified for the user in v2.

Below is my understanding of how to dynamically create sub navigation through categories and pages. If somebody has a better method; by all means, point me in the right direction. This is really for others that are looking for something similar and will hopefully save them some time.

In reading this, I am assuming that you have already beaten your head against the wall a few times, drank some coffee, and found this:

Directions

1. Install the pages module
2. When creating the URI segments for pages, segment 1 of your URI is your parent; therefore, segment 2 is the child. When creating a child, be sure the parent segment matches. Also, the URL title should match the URI segment when publishing the page. Be sure to choose the correct template file you will be creating later on.

Example:
services
services/development
services/development/agile

3. Create categories under “Publish”. Be sure to match the category name with the parent URI segment
4. Create a sub template file and use the following code to render the sub navigation dynamically:

{exp:weblog:categories weblog="section" dynamic="off"}
{if category_name
== segment_1}
<ul id="side_nav">
    
{exp:weblog:entries weblog="section" dynamic="off" show_pages="only" category="{category_id}" orderby="menu_level" sort="asc"}                    
    
<li class="side_nav_{if segment_2 == url_title}on{if:else}off{/if}"><a href="{page_url}">{title}</a></li>              
    
{/exp:weblog:entries}
</ul>
{/if}
{
/exp:weblog:categories}

The example above is for a second level side navigation. You can change the segment numbers, create child categories through publish, create pages with the URI as described in directions in order to get a level 3+ navigation dynamically.

Thank you.

Profile
 
 
Posted: 16 May 2008 06:20 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRank
Total Posts:  2011
Joined  2002-12-06

I’ve got a few approaches to building static nav on my site - none of which involve the pages module.

 Signature 

Train-ee.com - eBooks, Tutorials and Screencasts designed to help you Learn ExpressionEngine Fast.
Boyink Interactive - A charter member of the EE Pro Network.

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 10:33 AM
Total Registered Members: 58103 Total Logged-in Users: 22
Total Topics: 68104 Total Anonymous Users: 12
Total Replies: 366741 Total Guests: 411
Total Posts: 434845    
Members ( View Memberlist )