I knew that you can query umbraco to generate a list of subpages of a parent page, my question is how can you set the value of $currentPage to one of these parent pages, so the following code will generate a list of subpage only under that chosen parent page.
Or, if possible, how can I query umbraco to generate a list of pages with certain document types?
What you want to do is easily done. Simply create a new xslt macro (right-click on the XSLT Files item in the developer section of umbraco). Give the xslt a name and select one of the pre-defined templates. In your case, you'd probably want pages from a 'changable source' or 'by docType'. The various built-in templates are a great start to most situations.
How to set current page variable to a chosen page
Hi guys and girls:
I knew that you can query umbraco to generate a list of subpages of a parent page, my question is how can you set the value of $currentPage to one of these parent pages, so the following code will generate a list of subpage only under that chosen parent page.
Or, if possible, how can I query umbraco to generate a list of pages with certain document types?
<xsl:for-each select="$currentPage/node [string(data [@alias='umbracoNaviHide']) != '1']">
<li>
<a href="{umbraco.library:NiceUrl(@id)}">
<xsl:value-of select="@nodeName"/>
</a>
<br/>
<xsl:value-of select="data [@alias = 'metaText']"/>
</xsl:if>
</li>
</xsl:if>
</xsl:for-each>
Thanks & Regards,
It's probably not best to re-assign currentPage variable as may cause problems at a later date for readability etc...
The code below will display nodes where the nodeType is of yourDocTypeAlias
The code below will display nodes where the nodeType is NOT of yourDocTypeAlias
I hope I understood your question correctly.
Warren :)
Following code will list all documents of a type
I forgot to mention that this code will display child nodes of the currentPage/node you are on.
What you want to do is easily done. Simply create a new xslt macro (right-click on the XSLT Files item in the developer section of umbraco). Give the xslt a name and select one of the pre-defined templates. In your case, you'd probably want pages from a 'changable source' or 'by docType'. The various built-in templates are a great start to most situations.
cheers,
doug.
Warren Buckley, Masood Afzal and Douglas Robar
Thanks very much to all you guys. All your solution helped, I just have one more question, how can I replace
<xsl:for-each select="$currentPage/node [@nodeTypeAlias = $documentTypeAlias and string(data [@alias='umbracoNaviHide']) != '1']">
which only display sub pages of a parent node with select="$variable that can display all document with [@nodeTypeAlias = $documentTypeAlias
Once again.
Thanks & Regards,
Hi jefferycxl,
Following snippet should do:
All you do is get the xml fragment from parent node (GetXmlNodeById(parentId) and iterate its children.
Hope this helps.
Regards,
/Dirk
Sorry guys, Masood Afzal, I misunderstand your code, I used your code $currentPage/ancestor-or-self::root//node and it worked beautifully.
Please ignore my previous question.
Thanks
Hi Dirk De Grave
Thanks very much for the help.
Love the umbraco forum !
is working on a reply...