Setting template property from a content page (sitefinity 4.4)
the site that I'm working at is designed in a such way that CSS class is set for the <body> tag on all the pages and the css classes used are different for all pages. Each page has common elements such as a header, a footer and a nav bar. I'd like to set up a single page template and include all common elements there but the body tag stands in the way. Is there a way to control a template from a content page? I know I can specify a code behind for content pages but i can't rely on content authors to enter it correctly each time they add a page. My current thinking is to set up multiple page template, one for each css class that is referenced in the body tag and put the common page elements into user controls. This is less than ideal because I will end up with lots of mostly identical templates and my user controls would not be editable easily. I guess I would have to use shared content items and such making the content authors hunt all over the site. I would have been much simpler to update the common header in a single page template.
Can someone please suggest a way?
hi dmitri,
how are the css classes chosen for the body tag? Is the template using a master page? It is possible to set the body css class using the code-behind of the master page so that it is automatically set based on some criteria.
This way the template can have all the unified elements, but the body class can change based on the code-behind of the master page.
will that work? If you tell me more about how you choose the body css class I can try to offer different solutions ...
hope this is helpful!
thank you for the reply.
OK I got this to work with Meta tags set at the content page level. I read the meta in the master page's code behind and set the body css accordingly. this technically works but the content authors will need to be mindful of this workaround. Still, I with there were page properties.