DotNetNuke Powered!
          
John Mitchell's (mostly DotNetNuke) Blog - DotNetNuke Skin Background images based on TabName
 Thursday, March 23, 2006

Here's a little trick that spawned out of a question on the DotNetNuke Forums.

The question was:

I am trying to get a background image in a table in my skin to change with each page. i.e. Home has a faint background image saying "home", News has a faint background image saying "news"

And it got me thinking that it would be cool to be able to use the TabName dynamically.

After a little digging, it turns out that the TabName property is easily accessible from a DotNetNuke Skin:

<%= PortalSettings.ActiveTab.TabName %>

Then just make a background image that includes the tabname in it's name and reference it something like this:

<td  style="background:url(<%= SkinPath & PortalSettings.ActiveTab.TabName %>BG.gif)" >

In the above example, if you have an image named HomeBG.gif in your skin folder, then it will be used for the background of that table cell when you are on the home page.

Create another one called NewsBG.gif and it will show when you are on the News page.

The PortalSettings collection has a ton of information in it.  I wonder what other cool things could be done with it? ;)

3/23/2006 4:01:25 PM (Central Standard Time, UTC-06:00)  #    Comments [8]