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.
get current page hierarchy position
-
- Forum Members
- Posts: 38
- Joined: Tue Dec 30, 2008 1:09 pm
Re: get current page hierarchy position
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...
-
- Forum Members
- Posts: 38
- Joined: Tue Dec 30, 2008 1:09 pm
Re: get current page hierarchy position
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.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...
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...
Re: get current page hierarchy position
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
Then another call, {menu .... start_level=2} which will show the children of the selected parent and thus all pages UNDER the language.
Ronny
-
- Forum Members
- Posts: 38
- Joined: Tue Dec 30, 2008 1:09 pm
Re: get current page hierarchy position
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: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).
Code: Select all
<ul>
<li class="sectionheader"><span>en</span>
</li>
<li class="sectionheader"><span>it</span>
</li>
</ul>
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.
Yes, that is what I am doing for the main menu.Then another call, {menu .... start_level=2} which will show the children of the selected parent and thus all pages UNDER the language.
Thanks Ronny.
richard