I have a website with say 5 nodes in the first tier of navigation... aka my main menu items. Each node will have it's own header image... some of the nodes have 20 or 30 child nodes... I'd rather not have to insert the header for each and every page, and I'd rather not have 5 or 6 versions of each template.
What I would like to be able to do is insert a macro or something in my template to find the header assigned to the parent node, and display that header. Is this possible?
Hi, for the 5 parents nodes, create a property with the image in it and, in the template, call the image recursively, so the child will look for the parent.
I'm still alive!! Ok, contains with an S... my bad! You have to replace the parent folder.
Exemple : My parent node is "Students" and, under I have child nodes "Homework" and "Exam". When I'll go to exam.aspx, the url will look like : www.mysite.com/students/exam.aspx
So, the test will check if the word 'students' (whitout the ' ') is in the url, and, if yes, it will display your img. If not, it will pass is path.
Getting header image for parent node
I hope this will make sense...
I have a website with say 5 nodes in the first tier of navigation... aka my main menu items. Each node will have it's own header image... some of the nodes have 20 or 30 child nodes... I'd rather not have to insert the header for each and every page, and I'd rather not have 5 or 6 versions of each template.
What I would like to be able to do is insert a macro or something in my template to find the header assigned to the parent node, and display that header. Is this possible?
Thanks guys!
Hi, for the 5 parents nodes, create a property with the image in it and, in the template, call the image recursively, so the child will look for the parent.
ok, you gotta put that in idiot speak... ROFL. I am not a guru, I'm a cut and paste kinda guy.
Assuming each parent node is doc type TextPage and template TextPage... both of which are used in child nodes as well...
I'm gonna have to make new doc types I bet...
Did I mention this site is already live? LOL
Ok, so it's live... ok, you'll put a macro in your header that will choose the right img.
the macro :
if test="contain(umbraco.library:NiceUrl($currentPage/@id),'parent folder')"
img
/if
And you do that for all you headers. The test says : "if the url contains 'parent folder', then img".
Hope it will help!
System.Xml.Xsl.XslLoadException: 'contain()' is an unknown XSLT function.
<xsl:if test="contain(umbraco.library:NiceUrl($currentPage/@id),'parent folder')">
<img src='<xsl:value-of select="PageHeader"/>' />
</xsl:if>
I'm still alive!! Ok, contains with an S... my bad! You have to replace the parent folder.
Exemple : My parent node is "Students" and, under I have child nodes "Homework" and "Exam". When I'll go to exam.aspx, the url will look like : www.mysite.com/students/exam.aspx
So, the test will check if the word 'students' (whitout the ' ') is in the url, and, if yes, it will display your img. If not, it will pass is path.
Is it clearer?
is working on a reply...