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   2881 Views

Avatar
AdamCGray

Community Member, 4 Posts

9 July 2010 at 10:25pm

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

Community Member, 133 Posts

13 July 2010 at 7:42pm

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

Community Member, 4 Posts

13 July 2010 at 8:47pm

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

Community Member, 133 Posts

13 July 2010 at 10:40pm

Edited: 13/07/2010 10:40pm

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 %>