I've taken over a project from someone else, and this is my first time using umbraco. I have had to rearange the nodes in this site. As a result, top level node 'Catalogue' is now under top level 'Site'. I want all pages in the site with a certain checkbox ticked to include them in a slider on the home page.
I should point out I've inherited a project and suspect a lot of stuff is not done 'correctly'
OK, I've got rid of the named nodes.
<xsl:for-eachselect="$currentpage/* [@isDoc and showInSlider=1]">
This works for everything below the current page (obviously). I want to break out of that and pull all pages where showInSlider is checked. Something like:
<xsl:for-eachselect="umbraco.library:GetXmlAll()/* [@isDoc and showInSlider=1]">
Hi Tony. Obviously you are along the right lines with the currentPage only getting the child items. You need to ammend your XSLT so it first walks upto the top level node from the currentPage first then to apply your child filter you need.
So for example:
<xsl:for-eachselect="$currentpage/ancestor-or-self::myHomeNodeAlias/* [@isDoc and showInSlider=1]">
Sorry a typo on my behalf. $currentpage should be $currentPage and yes obviously the nodetype alias should be changed from myHomeNodeAlias to the alias of the top level node. Normally people have a specific document type for the homepage. If this is not the case let me know and we can try another xpath.
But basically your goal is to get from currentPage to walk up the tree to the most top level node and then to walk back down it with your /* [@isDoc and showInSlider=1]
OK sorry my bad again as I am juggling a few things here.
As this is saying only select one level of XML child nodes beneath the <site> node which in this case are property nodes of the site node. So to say fidn this no matter how many levels deep we need to use //. However be warned this is quite an expensive xpath call and would be better to be more speicifc in your xPath.
Newbie: Getting all pages with a certain property
I've taken over a project from someone else, and this is my first time using umbraco. I have had to rearange the nodes in this site. As a result, top level node 'Catalogue' is now under top level 'Site'. I want all pages in the site with a certain checkbox ticked to include them in a slider on the home page.
Currently the xslt is getting:
How do I amend this to take into account the change in structure?
I should point out I've inherited a project and suspect a lot of stuff is not done 'correctly'
OK, I've got rid of the named nodes.
This works for everything below the current page (obviously). I want to break out of that and pull all pages where showInSlider is checked. Something like:
Any help will be gratefully received.
Hi Tony.
Obviously you are along the right lines with the currentPage only getting the child items.
You need to ammend your XSLT so it first walks upto the top level node from the currentPage first then to apply your child filter you need.
So for example:
Hope this helps.
Warren :)
Thanks for that. However, pasting your response results in this error
The variable or parameter 'currentpage' is either not defined or it is out of scope
Should I be replacing 'myHomeNodeAlias'?
Sorry a typo on my behalf. $currentpage should be $currentPage and yes obviously the nodetype alias should be changed from myHomeNodeAlias to the alias of the top level node. Normally people have a specific document type for the homepage. If this is not the case let me know and we can try another xpath.
But basically your goal is to get from currentPage to walk up the tree to the most top level node and then to walk back down it with your
/* [@isDoc and showInSlider=1]
Warren
Returning nothing
OK sorry my bad again as I am juggling a few things here.
As this is saying only select one level of XML child nodes beneath the <site> node which in this case are property nodes of the site node.
So to say fidn this no matter how many levels deep we need to use //. However be warned this is quite an expensive xpath call and would be better to be more speicifc in your xPath.
Thank you so very much. This should help me with just about everything I've been having issues with.
is working on a reply...