Setting template property from a content page (sitefinity 4.4)

378 Views Asked by At

the site that I'm working at is designed in a such way that CSS class is set for the 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?

1

There are 1 best solutions below

0
On

I submitted a reply in the Sitefinity forums where you originally posted this, but just in case you check here first I'll ask the same question: how is the css class for body determined?

if it can be done programmatically you can use the code-behind of the Master Page for the template to set it so that it's handled automatically.

If this won't work, tell me more about how the css class is assigned and I will try to come up with an alternative.

hope this is helpful!