Second level navigation

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Second level navigation

Beitragvon Japio » Do 26. Mai 2011, 15:45

Hi,

I'm working on a website with a topnavigation and a subnavigation.
The template for the topnavigation looks like this:

<we:navigation navigationname="menu" parentid="1"/>

<we:navigationEntry type="folder" navigationname="menu" level="1">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="menu" current="true" level="1">
<li><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="menu" />
</ul>

And the template for the subnavigation looks like this:

<we:navigation navigationname="menu" parentid="1" />

<we:navigationEntry type="folder" navigationname="menu" level="2">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="menu" current="true" level="2">
<li><strong><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /> &raquo;</a></strong>
<we:ifHasEntries>
<ul><we:navigationEntries /></ul>
</we:ifHasEntries>
</li>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="menu" level="2">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="menu" current="true" level="2">
<li><strong><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /> &raquo;</a></strong></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="menu" />
</ul>

The problem is i can't seem to figure out how to only show the second level for the subnavigation. Does anyone know how to do this?

Kind Regards,
Jasper

Benutzeravatar
Paladin
Senior Member
Beiträge: 361
Registriert: Mi 10. Feb 2010, 15:11
Kontaktdaten:

Re: Second level navigation

Beitragvon Paladin » Do 26. Mai 2011, 15:54

Sure, in every navi, you have the attribute "navigationname="xyz""
USE IT!

Example - Mainnavi

Code: Alles auswählen

<we:navigation navigationname="MainMenu" parentid="1"/>

<we:navigationEntry type="folder" navigationname="MainMenu" level="1">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="MainMenu" current="true" level="1">
<li><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="MainMenu" />
</ul>


Second, Footernavi (nearly the same, you guessed right:

Code: Alles auswählen

<we:navigation navigationname="FooterMenu" parentid="5"/>

<we:navigationEntry type="folder" navigationname="FooterMenu" level="1">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="FooterMenu" current="true" level="1">
<li><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="FooterMenu" />
</ul>


Now, also look at the "parentid="x"" field.

In the Navi-Tool, create Subfolders called "MainNav" and "FooterNav" (or whatever u can remeber for MainNavi and FooterNavi #g).
In these 2 folders, you create your Navi-Structure for one Main and second Footer.
After that, you set the ID of Main and Footer into the parentid Tag.

Best: Build 2 Templates, one for footer one for main, in your template, you can now simply include main-nav and footer-nav with <we:include
It's really that simple, isn't it ;)

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: Second level navigation

Beitragvon Japio » Do 26. Mai 2011, 16:21

Thanks for your reply. The thing is i have one navigation (parentid=1). In the header i want to show the first level, and in the left col i want to show the second level.
So i allready have 2 templates, the problem is the second template is showing both levels, and i just want to show the second level there.

Benutzeravatar
Paladin
Senior Member
Beiträge: 361
Registriert: Mi 10. Feb 2010, 15:11
Kontaktdaten:

Re: Second level navigation

Beitragvon Paladin » Do 26. Mai 2011, 16:27

Try to set the "level" attribute in the subnavi (with level="2"). Keep an eye on the folder Tag, it can be either type="folder" or type="item", i do not know, what kind your navi is like.

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: Second level navigation

Beitragvon Japio » Do 26. Mai 2011, 16:30

The top level items are folders, and the second level are items. I have set both to level="2" (see code above), but still i get both levels.

Benutzeravatar
Paladin
Senior Member
Beiträge: 361
Registriert: Mi 10. Feb 2010, 15:11
Kontaktdaten:

Re: Second level navigation

Beitragvon Paladin » Do 26. Mai 2011, 16:34

rename your subnavi with the navigationname Tag. Be sure, you named all navigationname for the main with the same and all for the subnavi to another, for example main navigationname="menu" (as is) and subnavi navigationname="subnavi"

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: Second level navigation

Beitragvon Japio » Do 26. Mai 2011, 16:37

So my subnav template looks like this now, but nothing has changed yet:

<we:navigation navigationname="submenu" parentid="1" />

<we:navigationEntry type="folder" navigationname="submenu" level="2">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="submenu" current="true" level="2">
<li><strong><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /> &raquo;</a></strong>
<we:ifHasEntries>
<ul><we:navigationEntries /></ul>
</we:ifHasEntries>
</li>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="submenu" level="2">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="submenu" current="true" level="2">
<li><strong><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /> &raquo;</a></strong></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="submenu" />
</ul>

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: Second level navigation

Beitragvon Japio » Do 26. Mai 2011, 16:40

I also tried using depth="2" in <we:navigationWrite/>

Benutzeravatar
Paladin
Senior Member
Beiträge: 361
Registriert: Mi 10. Feb 2010, 15:11
Kontaktdaten:

Re: Second level navigation

Beitragvon Paladin » Do 26. Mai 2011, 21:29

Okay, back on a PC ;)
You have 2 Navi, you need 2 seprate codes.
make the 2 templates i told you above.

code for "submenu" (main level 2 - maybe template submenu.tpml)

Code: Alles auswählen

<we:navigation navigationname="submenu" parentid="1" />

<we:navigationEntry type="item" navigationname="submenu" level="2">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="submenu" current="true" level="2">
<li><strong><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /> &raquo;</a></strong></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="submenu" />
</ul>


this should show you only the 2nd level navi

ThomasGoebe
Senior Member
Beiträge: 843
Registriert: Mo 26. Jul 2010, 23:44
Wohnort: Hannover
Kontaktdaten:

Re: Second level navigation

Beitragvon ThomasGoebe » Fr 27. Mai 2011, 01:12

Hi Japio,

the solution for a split navigation is a combination of depth an level:

main navigation:

Code: Alles auswählen

<we:navigation navigationname="menu" parentid="1"/>

<we:navigationEntry type="folder" navigationname="menu">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="menu" current="true">
<li><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="menu" depth="1" />
</ul>



sub navigation:

Code: Alles auswählen

<we:navigation navigationname="submenu" parentid="1" />
<we:navigationEntry type="item" navigationname="submenu" level="1">
<?php /* no output for items in level1 */ ?>
</we:navigatioEntry>

<we:navigationEntry type="folder" navigationname="submenu" level="1">
<?php /* no output for inactive folders in level1 */ ?>
</we:navigationEntry>

<we:navigationEntry type="folder" navigationname="submenu" current="true" level="1">
<we:ifHasEntries>
<ul><we:navigationEntries /></ul>
</we:ifHasEntries>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="submenu">
<li><a href="<we:navigationField name="href" />"><we:navigationField name="text" /></a></li>
</we:navigationEntry>

<we:navigationEntry type="item" navigationname="submenu" current="true">
<li><strong><a href="<we:navigationField name="href" />" class="active"><we:navigationField name="text" /> &raquo;</a></strong></li>
</we:navigationEntry>

<ul>
<we:navigationWrite navigationname="submenu" />
</ul>



Kind Regards,
Thomas
Thomas Göbe
webEdition Partner aus Hannover
Autor des 1. webEdition Buch (gemeinsam mit Andreas Witt)
web: http://www.twinsystems.de

Japio
Member
Beiträge: 46
Registriert: Di 21. Jul 2009, 12:13

Re: Second level navigation

Beitragvon Japio » Fr 27. Mai 2011, 12:03

Thanks a lot!! That did the trick.


Zurück zu „webEdition Basic Version“

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast