what i'm trying to do is create a small sub-menu of pages. i want to be able to show this menu on any page not necessarily the parent of these pages. The target pages have a specific doctype.
I'm using the 'List subpages by document type' sample template provided however i can't figure out how to amend it to show pages of the specified doctype (no matter where they may be in the site).
my doctypes
Master ---> Home ---> Career
content
Home ----> Company -------> Careers ------------> Career1 ------------> Career2
So as you can see i want to create a submenu (macro) with links to Career1 and Career2 that i can place on any page on the site.
If you create a new xslt macro from the build in "List subpages from a changable source" you get the following:
[snip]
<!-- Don't change this, but add a 'contentPicker' element to --> <!-- your macro with an alias named 'source' --> <xsl:variable name="source" select="/macro/source"/>
<xsl:template match="/">
<!-- The fun starts here --> <ul> <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/node [string(data [@alias='umbracoNaviHide']) != '1']"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <xsl:value-of select="@nodeName"/>
</li> </xsl:for-each> </ul>
[/snip]
Now you only need to add a content picker to the marco parameter and you're of to a great start!
Basically, you're first getting the root level node using the ancestor-or-self [@level = '1'] and then selecting all nodes which are of 'CareerAlias' document type (Replace 'CareerAlias' with the alias for the document type you're trying to iterate) using the construct:
//node [@nodeTypeAlias = 'CareerAlias']
(Mind the double slash '//' as this gets all nodes in the tree, regardless of there position and level in the tree)
create a menu by doctype from any page
Hi
what i'm trying to do is create a small sub-menu of pages. i want to be able to show this menu on any page not necessarily the parent of these pages. The target pages have a specific doctype.
I'm using the 'List subpages by document type' sample template provided however i can't figure out how to amend it to show pages of the specified doctype (no matter where they may be in the site).
my doctypes
Master
---> Home
---> Career
content
Home
----> Company
-------> Careers
------------> Career1
------------> Career2
So as you can see i want to create a submenu (macro) with links to Career1 and Career2 that i can place on any page on the site.
Thank in advance
Paul
found answer
$currentPage/ancestor::root//node...
on another post
If you create a new xslt macro from the build in "List subpages from a changable source" you get the following:
Now you only need to add a content picker to the marco parameter and you're of to a great start!
/jesper
Hi Paul,
should do the trick.
Basically, you're first getting the root level node using the ancestor-or-self [@level = '1'] and then selecting all nodes which are of 'CareerAlias' document type (Replace 'CareerAlias' with the alias for the document type you're trying to iterate) using the construct:
(Mind the double slash '//' as this gets all nodes in the tree, regardless of there position and level in the tree)
Hope this helps.
Regards,
/Dirk
thanks guys.
Hi Paul,
Please mark the solution as solved so others may benefit from this!
TIA,
/Dirk
is working on a reply...