Themes for current session

Topics: Themes
Jan 4, 2008 at 5:42 PM
I do not suppose there is a way to get a different theme to only appear based on the IE browser session? Different blogger posters on the same site may want their own theme. So I was tinkering with the idea of trying to set some session for a theme for a browser without actually saving it in the setting. That way when the browser closes the original theme stayes. Is there a way I can code this somewhere on ascx? Can this even be done?
Jan 4, 2008 at 7:28 PM
Interesting you ask. I thought of similar theming functionality, but based on page- or even parent/sitemap level. Wonder if that's possible either?

Trying to understand your approach - would you like to serve a different theme based on individual blogger/author of the post?
Jan 4, 2008 at 8:40 PM

MikevZ wrote:
Interesting you ask. I thought of similar theming functionality, but based on page- or even parent/sitemap level. Wonder if that's possible either?

Trying to understand your approach - would you like to serve a different theme based on individual blogger/author of the post?


yes basically.
In my scenario there are multiple bloggers in BlogEngine. However each one wants their own theme. This cannot be done however as one theme serves the website. I really do not want to be forced to make a seperate db/webapp for each blogger, that would make things very cumbersome maintenance wise considering the user/commenter base will be the same. I saw that passing '?theme=Leaves' to the url line does the trick. It actually works on practically every page if you just artificially add it to the url line and click go. Which leads me to believe that I could have come up with a simple hack to alter the theme for the browser section and that would solve my problem. I have not looked into the code extensively but I am hoping that maybe on an ascx page I can access perhaps the session object and change the theme there. That of course will work if only the app determines its theme based of a set session value instead of a constanly posted config extraction of the theme setting. Hope I did not lose you there.
Jan 6, 2008 at 9:27 AM
Still with you, I hope. Your trick ?theme=SpecificAuthor could provide workarounds and show a custom theme per blogger. I wish some proven, ready code was at hand. Maybe somebody finished editing the PostView.ascx in the overall main theme with If ... Then conditions based on the <%=Post.Author%>.

That serves a custom theme then, but another community member could point you to the exact code and lines. The option that would show the main theme for a single post, but a custom theme on a post listing basis, is using URL rewrite for /author/BloggersName.aspx?theme=CustomTheme in the web.config. For example:

<urlMappings enabled="true">
<add url="~/JohnDoe/Default.aspx" mappedUrl="~/author/John%20Doe.aspx?Theme=JohnsTheme"/>
<add url="~/Fraygos/Default.aspx" mappedUrl="~/author/Fraygos.aspx?Theme=MyTheme"/>
</urlMappings>

Yes, a dirty workaround and only for post listings - not per single post view (the job of PostView.ascx).

Actually a useful feature request for BE.Net to support custom per-author settings, beyond custom themes. I mean, many multiple-authors blogs would like to link the "By: Author's name" to the author's external, personal website/blog or about page instead of http://example.com/author/john%20doe.aspx, wouldn't you?

Hope you're still with me too ;-)
Jan 7, 2008 at 4:23 PM
I tried the url mappings(altered to my page of course) and it did not work, but it still has that same problem, only alters the one page on not the rest for duration of setting, granted there would no be many accesable pages for commenters