Site structure
Version 4.x > Site structure > Custom Node/Template properties View modes: 
User avatar
Member
Member
kevmiller77-googlemail - 7/22/2009 11:24:38 AM
   
Custom Node/Template properties
Hi,

I was wondering if I can add custom properties to a page in the site or a specific ASPX template? I need to change a class on the body tag, in the Master page, depending on the page or template displayed.

This is so we can use CSS to change the layout of the page using this css class, meaning I can reduce the amount of HTML or master pages needed.

Thanks for any help,

Regards,

Kevin

User avatar
Kentico Developer
Kentico Developer
kentico_martind - 7/27/2009 2:39:41 PM
   
RE:Custom Node/Template properties
Hi Kevin,

You can check current page or template of current page directly in code-behind of your ASPX master template and then just set appropriate class into BodyClass property. You can use e.g. CMS.CMSHelper.CMSContext.CurrentPageInfo.NodeAliasPath property to identify current page and CMS.CMSHelper.CMSContext.CurrentPageInfo.PageTemplateInfo object to identify template of current page.

Best Regards,

Martin Dobsicek