6

I am working with ExpressionEngine and the Structure add-on latest versions.

I am looking for some help on generating a 4 items nav bar, where two items are in a different Structure level.

My Structure rows look like this:


Services (parent)

-----Translation (child)

-----Videos (child)

Studio (parent)

About us (parent)


And my main navigation bar should be:

Translation - Videos - Studio - About us

As you can see they are at different levels. I've been working for hours trying even with Structure Entries add-on, but I simply cannot find a way to generate this navigation.

I'd appreciate any help you can give me.

Edward J Beckett
  • 5,061
  • 1
  • 41
  • 41
  • Is there any particular reason why your Structure hierarchy doesn't match the navigation that you want to use? If it did Structure would do all of the hard work for you. – Dom Stubbs Nov 01 '12 at 19:23

4 Answers4

8

Structure ultimately stores its 'pages' as regular EE entries, so you could just hardcode the entry ID's into a channel:entries loop to grab the titles:

<ul>
{exp:channel:entries dynamic="no" entry_id="3|4|6|12" disable="categories|pagination|member_data"}
    <li><a href="{page_uri}">{title}</a></li>
{/exp:channel:entries}
</ul>

Alternatively if you want to give the client complete control of what appears in the navigation you could set up a custom checkbox field for 'show on primary nav' and then use something like this:

<ul>
{exp:channel:entries dynamic="no" search:options="=show on primary nav?" disable="categories|pagination|member_data"}
    <li><a href="{page_uri}">{title}</a></li>
{/exp:channel:entries}
</ul>

(would be a bit nicer using P&T Checkboxes instead of the crappy built-in ones.)

No offence to the Structure module but it's this kind of thing that would really make me use Nav-EE instead, or, more often I would opt for an entirely hardcoded top level nav... The client usually thinks they need full control but in reality that top level navigation is seldom going to change (and when it does the chances are they'll need you to do other work on the site anyway!).

James Smith
  • 528
  • 3
  • 9
  • Hi, James, I've just tried the hard coded one and it works great. I used fixed_order="3|4|6|12" to control the output. Many thanks! – Sergio Acosta Nov 01 '12 at 20:29
  • 1
    @SergioAcosta don't forget to mark James answer as accepted if it's proved to be the solution that works for you. – Tyssen Nov 01 '12 at 21:17
5

You are looking for Structure Entries: http://devot-ee.com/add-ons/structure-entries (which is free!)

3

I managed to get the Structure way to get that navigation, which is quite a code:

<ul class="myclass"> 
{exp:structure:nav start_from="/services" include_ul="no"}
{exp:structure:nav exclude="21|4|10" max_depth="1" include_ul="no"}
</ul>

I found the James' hard coding solution a best option. Thank you!

0

Since you've already spent significant time fiddling with Structure Entries, I'd say give Taxonomy a shot since it will surely get the job done with very little fuss. http://devot-ee.com/add-ons/taxonomy

For the purpose of managing a nav tree that doesn't fit the mold, the Taxonomy module is very handy and flexible.

Alex Kendrick
  • 969
  • 9
  • 18
  • I sounds interesting. Do you know if Taxonomy plays nicely with Structure? – Sergio Acosta Nov 03 '12 at 13:37
  • Yes, it does. It's very flexible so can work with templates/entries or with "page URI's" (which is what both Structure and Pages module create). You just choose the entry (page) you want to link to and then check "use pages URI" and then you're set. It also has options for linking to custom URLs. Really flexible. – Alex Kendrick Nov 03 '12 at 17:49