DNN websites, modules, skins and support

Menu: Blog

DNN Style Helper V02.11.00 Released


New DNN PortalSettings and TabSettings Tokens

I regularly use the same skin / theme for simple websites, where I add some simple colour / style variations for specific clients. These clients don’t edit the colours themselves but we prepare a stylesheet for them overruling styles of the used Theme.
(Which is more manageable than creating a “fork” of the theme for each client)

We needed a way to set Style to load for which client.

In theory one could do this based on the domain-name (IfUrl) or Portal.css but that’s a risk.
Either because an admin could delete the CSS and it would not work very well with a local copy of the skin. Also you would have to add the conditions to the ascx files for each new client.
So I added support for Tokens to pull values in from PortalSettings or TabSettings database tables.


This means we can add a “Client” setting to the PortalSettings Table and use the Style Helper like this:

<fortyfingers:STYLEHELPER ID="ffsh1" BodyClass='[Portal:Settings.Client]' runat="server" />

Then add this to you Style Sheet (very basic example):

h1, h2, h3, h4, h5, h6{color:#f00;}

            h1, h2, h3, h4, h5, h6{color:#00d;}

            h1, h2, h3, h4, h5, h6{color:#f80;}


Another option could be to use:

<fortyfingers:STYLEHELPER ID="ffsh2" AddToHead='<link href="[S][Portal:Settings.ClientStyleSheet]" media="all" type="text/css" rel="stylesheet"></link>' runat="server" />

Which would get the style sheet name from the “ClientStyleSheet” setting in the PortalSettings table.

<link href="/Portals/40F-Style-Helper/Skins/40F.Skin.Demo.Style-Helper/Client1.css" media="all" type="text/css" rel="stylesheet">


Editing PortalSettings or TabSettings.

We are working on a component to edit these values for now you either have to edit the database or write your own code to do this.

If the settings don’t exist yet you can edit the PortalSettings or TabSettings tables.
Please make sure you insert the correct Portal Id or Tabid and locale (they are stored per Locale)

Please note that after editing the database values, you need to restart DNN as these values are cached.

Here’s some code to save these settings:

PortalController.UpdatePortalSetting(PortalSettings.PortalId, PropertyName, Value)

Dim oTabC As New TabController

                        oTabC.UpdateTabSetting(PortalSettings.ActiveTab.TabID, PropertyName, Value)