What is the easiest way to show a dynamic main section header?
I have a tree structure
section 1
section sub 1
section sub 1
section sub sub 1
section sub sub 1
section 2
section sub 2
section sub 2
section sub sub 2
section sub sub 2
What I would like is to always show the title of the "root section". If I travel down to section sub sub 1 page, I want to show the title of section 1 on the same page.
If I use the [*menutitle*] I always get the title of the page I’m on. Is there a way to get only the "top section" title instead?
Hi,
you can use getField snippet and ultimateParent.
[!getField? &docid=`[[UltimateParent]]` &field=`pagetitle` !] should do the trick
:-)
EDIT: you could add a conditionnal statement with PHx to display the section header if needed
[+phx:if=`parent`:ne=`0`:then=`[!getField? &docid=`[[UltimateParent]]` &field=`pagetitle` !]`+]
Yes, that worked. Thanks for quick reply.
Check the &top parameter of the UltimateParent.
It tells the snippet where to stop going upwards in the tree.
In your case, set &top=`2` and you’ll get the desired result.