Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions

Get current page level


Reply

4 Posts   2682 Views

Avatar
AdamCGray

9 July 2010 at 10:25pm Community Member, 4 Posts

Hello,

Is there a simple way of getting the level of the current page within the navigation structure? I.e. top of section, sub page, sub sub page etc.

The reason is that I need the submenu for each section to appear in a different place depending on whether the user is on a top level section page or a sub page. So for example, in the following structure:

About us
|- The past
|- The future
|- Members

The 'the past, the future, members' submenu would appear at the *top* on the 'About us' page but on the *bottom* of the 'The Past' page. Realise this is a very confusing description but hope it makes vague sense. Is this possible?

Avatar
3dgoo

13 July 2010 at 7:42pm Community Member, 133 Posts

In the control of Level(1) or Menu(1) you can check the linking mode:

<% if LinkingMode = current %>

// This would be the About us page

<% else_if LinkingMode = section %>

// This would be the sub pages

<% else_if LinkingMode = link%>

// This would be out of this section completely

<% end_if %>

Avatar
AdamCGray

13 July 2010 at 8:47pm Community Member, 4 Posts

Thanks for your reply; that tests for the level of the page being linked *to* but not the current (i.e. referring) page, which is what I need to do! Any other thoughts?

Avatar
3dgoo

13 July 2010 at 10:40pm (Last edited: 13 July 2010 10:40pm), Community Member, 133 Posts

I can't believe I didn't remember this before:

<% if Level(1) %>
   // Do what you want
<% else_if Level(2) %>
   // Do what you want
<% else %>
   // Do what you want
<% end_if %>