We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Navigator module (navigation builder)

Development and Programming

Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

And thanks to Ryan for telling me about it as well. Really nice work Cocoaholic, it’s great for a site I’m working on.

       
Nico Smit's avatar
Nico Smit
48 posts
16 years ago
Nico Smit's avatar Nico Smit

Feature request: subcategory possibility!

       
Colin Lewis's avatar
Colin Lewis
55 posts
16 years ago
Colin Lewis's avatar Colin Lewis

Yes! This is an amazing module and gave me exactly what the client asked for: a 3 level navigation, nested lists with links that the client can manage.

In case anyone needs help with nesting navigation groups, read on.

I followed dreamscape’s advice which was deviously clever; subcategories are fairly simple this way. The trick is to set up several navigation groups - 1 for the top level, 1 for each 2nd level group, 1 for each 3rd level group - and to set “nav_properties” in the parent link so that you target the child links. If your “About” link needs to open up a subcategory that you’ve placed in group 2, set nav_properties in “About” to “2.” Easy peasy.

Here’s my nav, located in the main page template:

<ul>
{exp:navigator group="1"}
<li>
<a href="http://{nav_url}{nav_url_title">{nav_title}</a>
{if nav_properties <> "0"}{embed="inc/nav-2" group="{nav_properties}"}{/if}
</li>
{/exp:navigator}
</ul>

I set nav_properties to “0” if there is no child category. If nav_properties isn’t “0” then template nav-2 is embedded:

<ul>
{exp:navigator group="{embed:group}"}<li>
<a href="http://{nav_url}{nav_url_title}">{nav_title}</a>
{if nav_properties <> "0"}{embed="inc/nav-3" group="{nav_properties}"}{/if}
</li>{/exp:navigator}
</ul>

same thing for the third level, template nav-3:

<ul>
{exp:navigator group="{embed:group}"}<li><a href="http://{nav_url}{nav_url_title}">{nav_title}</a></li>{/exp:navigator}
</ul>

Cocoaholic, I can’t thank you enough for this. 😊

       
launch's avatar
launch
7 posts
16 years ago
launch's avatar launch

How do you make this work with MSM?

So far it seems to only use the weblogs from my primary path.

Thanks

       
Cocoaholic's avatar
Cocoaholic
445 posts
about 16 years ago
Cocoaholic's avatar Cocoaholic

Module updated to 1.3

New in this version: - MSM compatibility

Note: - If you are already using the module with MSM and you have some navigator groups setup be aware that after updating the module all existing navigator groups will be assigned to site 1. Contact me if you have a large amount of navigator groups and really need some way to re-assign those groups to different sites.

If you have any questions feel free to contact me!

       
launch's avatar
launch
7 posts
about 16 years ago
launch's avatar launch

Thanks so much for this!

       
Beebs's avatar
Beebs
207 posts
15 years ago
Beebs's avatar Beebs

I wonder if anyone can give the example of the dropdown navigator?

       
Beebs's avatar
Beebs
207 posts
15 years ago
Beebs's avatar Beebs

Perhaps this is just wish-list but how possible to include (background) image within each menu item ? I try to put it in the Property field but It does not work. My idea is resemble with the way Category Image option is available in EE.

       
mr_tim's avatar
mr_tim
43 posts
15 years ago
mr_tim's avatar mr_tim

I have a multi-level drop down menu as per Colin Lewis and I’m looking to move to Navigator but am trying to figure out how to highlight the menu item of the that you are currently on.

With the old hardcoded navigation I had this;

<li class="{if segment_1=='about-us'}current{/if}"><a href="http://{site_url}about-us"><b>About Us</b></a></li>

I’ve played around and can’t quite get it going, if any one has any suggestions?

       
Ryan M.'s avatar
Ryan M.
1,511 posts
15 years ago
Ryan M.'s avatar Ryan M.

@mr_tim: Try:

{if '{segment_1}'=='about-us'}
       
mr_tim's avatar
mr_tim
43 posts
15 years ago
mr_tim's avatar mr_tim

Thanks mdesign - to clarify, my hardcoded example does work, but when trying to incorporate Navigator I’m not sure of the best what to go about it with Navigator’s loops etc. e.g.

<li{if segment_1=="{nav_description}"} class="current"{/if}><a href="http://{nav_url}{nav_url_title}"><b>{nav_title}</b></a></li>

I’ve put about-us in the nav_description field but’s not working - it’s fine if I replace {nav_description} with about-us…

       
Jack Tse's avatar
Jack Tse
67 posts
15 years ago
Jack Tse's avatar Jack Tse

I’m trying to get the second level to appear only when I’m in a certain section…

I want my second segment to match up to my nav_property which would hopefully kick in and embed on just that one page like this:

<ul>
{exp:navigator group="solutions"}
<li>
<a href="http://{nav_url}">{nav_title}</a>
{if "{segment_2}" == "{nav_properties}"} {embed="solutions/nav-2" group="{nav_properties}"} {/if}                               
</li>
{/exp:navigator}
</ul>

I even tried passing a variable like this in my embeds:

{if "{embed:my_location}" == "data-federation"}{embed="solutions/nav-2"} {/if}

But I can’t seem to target that specific page.

Any thoughts? Much appreciated!

       
launch's avatar
launch
7 posts
15 years ago
launch's avatar launch

Here is how I am doing it:

In my main template I embed the menu like this:

{embed="menus/side_menu" side_menu_title="Main Menu" side_menu_group="1"}

Then in the side_menu file I have this:

<div class="module_container">
<div class="module_header">
   <h1>{embed:side_menu_title}</h1>
</div>
<div class="module_content">
   <div id="nav_container">
      <ul>
      {exp:navigator group="{embed:side_menu_group}"}
         <li>
           <a href="http://{nav_url}">{nav_title}</a>
              {if nav_properties != ""}
                 {embed="menus/side_menu_l2" group="{nav_properties}" parent="{nav_description}"}
              {/if}
         </li>
      {/exp:navigator}
      </ul>
    </div>
  </div>
</div>

Then in the side_menu_l2 I have:

{if segment_2=="{embed:parent}"}
  <ul>
    {exp:navigator group="{embed:group}"}
      <li>
        <a href="http://{nav_url}">{nav_title}</a>
      </li>
    {/exp:navigator}
  </ul>
{/if}

This is using the pages module for static pages which is most of the content on the site. I am pretty busy so I may not be able to get back to you right away.

Essentially, the way this is working is the main template embeds the menu and tells it which navigator group to pull at the 1st level.

Then on any of the menus if there is a property set in the navigator module, it will then embed the second level using the property field as the group to embed.

When the second level gets embedded, the nav description of the parent menu gets passed through the embed.

Then the second level embed checks to see of segment_2 of the current url matches the nav_description of the parent menu. If it does match then the 2nd level embed then outputs the sub-menus.

Hope this will help you in the right direction. You may have to adjust things a bit to get it working in your specific situation, hopefully someone here will be able to help you.

Let me know what solution you come up with.

Best of luck.

Steve

       
Milan Topalov's avatar
Milan Topalov
128 posts
15 years ago
Milan Topalov's avatar Milan Topalov

How do I test for the last item? I can’t seem to find this in the docs.

Something like

{if last_item}
do stuff
{/if}

or like in Weblogs module

{if count == total_results}
do stuff
{/if}

Thanks!

       
fjldude's avatar
fjldude
50 posts
15 years ago
fjldude's avatar fjldude

While setting up conditionals to add classes to my navigation items, I ran into the same problem as mr_tim’s post #100 above.

But then I discovered I can just swap the order of the conditional.

Instead of

{if segment_1=="{nav_description}"}

I used

{if nav_description=="{segment_1}"}

I’m not sure why this works… time to dig into the docs

       
First 5 6 7 8

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.