get current page hierarchy position

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
backwoodsman
Forum Members
Forum Members
Posts: 38
Joined: Tue Dec 30, 2008 1:09 pm

get current page hierarchy position

Post by backwoodsman »

I have wasted hours searching these forums for this. I am sure someone must have answered it before, but ...

I need to get the hierarchy position of the current page (eg 1.4.2) , also, preferably, the name of its root node. Then I also need to generate the url for a calculated hierarchy position -- but I think I have seen the solution to that in some discussion on menus.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: get current page hierarchy position

Post by Dr.CSS »

Hierarchy can be found using {$friendly_position} for root parent name etc. install CGSimpleSmarty and look at the Help as it has examples of this...
backwoodsman
Forum Members
Forum Members
Posts: 38
Joined: Tue Dec 30, 2008 1:09 pm

Re: get current page hierarchy position

Post by backwoodsman »

Dr.CSS wrote:Hierarchy can be found using {$friendly_position} for root parent name etc. install CGSimpleSmarty and look at the Help as it has examples of this...
That has been a great help, but I am still struggling: I need to get all siblings of the root parent. This is for a languages hierarchy of pages if that helps explain the kind of thing I am doing. I shall put this either in a template or more likely in a tag.

I would also like to be able to expand the url for a given hierarchy position (for example turn 2:3:1 into fr/foo/bar).

I am hoping I don't need to write low level code to do these tasks...
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: get current page hierarchy position

Post by RonnyK »

Could you post the way your structure is setup, as f.e. with main-level to be FR/EN, you could use a {menu number_of_levels=1} for ONLY first level (being languages).

Then another call, {menu .... start_level=2} which will show the children of the selected parent and thus all pages UNDER the language.

Ronny
backwoodsman
Forum Members
Forum Members
Posts: 38
Joined: Tue Dec 30, 2008 1:09 pm

Re: get current page hierarchy position

Post by backwoodsman »

RonnyK wrote:Could you post the way your structure is setup, as f.e. with main-level to be FR/EN, you could use a {menu number_of_levels=1} for ONLY first level (being languages).
Yes, that is right -- at the moment it is only 'en' and 'it' at level 1 and then parallel structures of two further levels in each language. So '{menu number_of_levels=1}' gives:

Code: Select all

<ul>
<li class="sectionheader"><span>en</span>
</li>
<li class="sectionheader"><span>it</span>
</li>
</ul>
when all I want is a list like 'en it' in order to construct a row of links with flags allowing a jump tot he equivalent page in any other language.
I di look at the ways other people solve this, and they all seem more complicated -- though it turns out this method is oddly difficult too!

Second thoughts: in fact I think that is all I need -- should be able to work it with css now.
Then another call, {menu .... start_level=2} which will show the children of the selected parent and thus all pages UNDER the language.
Yes, that is what I am doing for the main menu.

Thanks Ronny.

richard
Post Reply

Return to “Modules/Add-Ons”