Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I want to give the <body> tag an id/class based on the parent page. For example my site map looks like this:
Parent Child pages
About Us -> What we do | More about us | More about our associates
The "About Us" page currently has the class <body id="about-us"> and this is taken from a field called bodyID that I created in the properties.
Is there a way that I can pass this bodyID automatically to any child pages so they have this body class?
Cheers, Garry.
If you use the page property directly in templates you can use
recursive=true
for it to apply to child pages
eg
<body class="<umbraco:Item field='bodyID' runat='server' recursive='true'>">
(note the single quotes)
Or in xslt you can just look for the parent(s)
$currentPage/ancestor::node/data [@alias="bodyID"]
Hope this helps,Dan
Brilliant - the recursive=true parameter worked.
This is why I love umbraco - excellent and responsive user base - thanks very much!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
body id/class depending on parent page
Hi,
I want to give the <body> tag an id/class based on the parent page. For example my site map looks like this:
Parent Child pages
About Us -> What we do | More about us | More about our associates
The "About Us" page currently has the class <body id="about-us"> and this is taken from a field called bodyID that I created in the properties.
Is there a way that I can pass this bodyID automatically to any child pages so they have this body class?
Cheers, Garry.
If you use the page property directly in templates you can use
for it to apply to child pages
eg
(note the single quotes)
Or in xslt you can just look for the parent(s)
Hope this helps,
Dan
Brilliant - the recursive=true parameter worked.
This is why I love umbraco - excellent and responsive user base - thanks very much!
is working on a reply...