By: Timo Breumelhof
I released a new version of the Style Helper skin object on codeplex, you can download it here: http://dnnskinextensions.codeplex.com/
Documentation on this page
Version 01.05.00 fixes some minor bugs and introduces some new functionality.
New Feature in Version 01.05.00
Inject CSS class in DNN page body Tag
You can now inject a CSS class to the page Body tag.
I have been using this functionality a lot before in my skins with some custom VB in the ASCX. I now decided to add this to the style helper skin object.
I normally use this technique to limit the number of skins I have to create.
If the skins for different pages have the same HTML and only the CSS is different, I prefer to use only one skin and address the different pages from skin.css with a CSS class in the body tag.
This makes skin management a lot easier, the Admin does not have to switch the skin for every new page.
For now you can add this as the body class (I'll be adding more tokens in the near future):
- The PageNames in the Breadcrumb
- The Page Ids in the Breadrumb
- The page order in the Breadcrumb
This allows you to address pages with a certain name, id or on a specific position on a level.
Because all the pages in the breadcrumb are added as a class, the level is also part of the class.
The skin object will convert the page name to a valid class name.
There are two attributes you can use.
Attribute AddBodyClass (True/False)
This will inject the class to the body with the default template
On a page "SubPage" on Level 1 which is a child of the page "RootPage" on Level 0 ,
this will be your body tag:
<body id="Body" class="L0_RootPage L1_SubPage Id68 Id100 L0_Nr3 L1_Nr2">
L0_RootPage3 > The current pages parent on level 0 named "RootPage"
L1_SubPage2 > The current page on Level 1, named "SubPage"
Id68 > The "RootPage" Id = 68
Id100 > The "SubPage" Id = 100
L0_Nr3 > "RootPage" is the third page on level 0
L1_Nr2 > "SubPage" is the second page on level 1
Attribute BodyClass (String)
The template for the class. If you set this attribute you don't have to set the AddBodyClass attribute.
The default template is: "[BcName] [BcId] [BcNr]"
[BcName] will render the Page Names in the breadcrumb as a class
[BcId] will render the Page Ids in the breadcrumb as a class
[BcOrder] will render the Page Order in the breadcrumb as a class
If needed you can also set or add a static class by setting the BodyClass attribute if needed.
Bugs fixed in version 01.05.00
- You can now use spaces after the comma in you RemoveCssFile attribute.
Example: "default.css, portal.css", before the space was condidered to be part of the file name.