I have tried to search for this... but I'm sort of struggling to find the answer!
Basically I want to put a dynamic variable in the template so that I can get a ID on the body tag that lets me give the page a specific style in CSS.
I've figured out how to add a custom field to the properties tab for all pages calls "Cssclass", but I'm not too sure how to render it's contents on the frontend.
If you could point me in the general direction of the answer that would be great!
Dynamic body id
I have tried to search for this... but I'm sort of struggling to find the answer!
Basically I want to put a dynamic variable in the template so that I can get a ID on the body tag that lets me give the page a specific style in CSS.
I've figured out how to add a custom field to the properties tab for all pages calls "Cssclass", but I'm not too sure how to render it's contents on the frontend.
If you could point me in the general direction of the answer that would be great!
Tristan
Hi Tristan, there's a package called Dynamic Body Tag in the projects section, that might be what you want?
Hi Tristan
Maybe this package is what you are looking for? http://our.umbraco.org/projects/dynamic-body-tag
Otherwise you could fetch the value for every single node in your content tree by writing an XSLT macro and placing it in <body> like this
<body <umbraco:Macro Alias="SetBodyId" runat="server"></umbraco:Macro>>
Let me know if you need further assitance.
/Jan
I'm simply just typing too slow...I think I need to speed up! :-)
Thanks both, and thanks for the speedy response!
I am curious though as to whether it's possible to actually just insert the contents of a custom property field in the template as well?
So it would be something like <body class="cssclassproperty">
thanks
Tristan
Yes, you can use the Umbraco:Item control to do this:
This would replace your <body> tag.
@Jan, sorry - I seem to keep posting at the same time ... I'll trying to slow down! ;-)
Cheers, Lee.
Thanks Lee, that's perfect!!
is working on a reply...