Different theme per category?

Topics: Themes
Dec 19, 2008 at 9:53 AM
I'm currently looking at various blog software for my next project. Blogengine.net looks ideal but is it possible to have different themes for different categories?
Feb 19, 2009 at 6:54 AM
I'm also very interested in having a feature like this, any news or code examples of the possibility?

Feb 19, 2009 at 4:44 PM
Yeah, I've been trying to figure out a way to break the login page out of the theme so I could have it in a lightbox popup.
Feb 19, 2009 at 11:13 PM
I am trying to do something similar.  You will have to modify the theme so that the login link opens up the popup.  In essense, you have to remove all links to the login page and handle it within the theme.  You can see what I have going on with that and new theme at http://www.ichoosetofeel.net
Feb 20, 2009 at 11:09 AM
@rclarkson although the idea is really great it doesn't really have anything to do with the initial question. Also I saw that on your link Chrome and FireFox renders your content outside of the page.
Feb 20, 2009 at 1:07 PM
BLAMO! Got it, find the file: BlogBasePage.cs, in the OnPreInit method play around with:

if (Request.QueryString["theme"] != null)
_Theme = Request.QueryString["theme"];

MasterPageFile = Utils.RelativeWebRoot + "themes/" + _Theme + "/site.master";

if (Request.RawUrl.ToLowerInvariant().Contains("/category/"))
                MasterPageFile = Utils.RelativeWebRoot + "themes/Scruffy/site.master";

Obviously you can play around with your existing categories, and substitute Scruffy with your desired temaplate.

Feb 20, 2009 at 4:27 PM
Another option you can do if you're modifying the BE core code is make the masterpage even more flexible by exposing a "masterpage property" you can set at any time or from any page.

Supporting Multiple Master Pages in BlogEngine.NET
Feb 24, 2009 at 10:27 AM
Sorry one more thing, I actually noticed that the posts weren't affected by my change but this is easily fixed:

if (Request.RawUrl.ToLowerInvariant().Contains("your category"))
                MasterPageFile = Utils.RelativeWebRoot + "themes/Indigo/site.master";
            else if(Request.RawUrl.ToLowerInvariant().Contains("/post/"))
                if (Request.QueryString["id"] != null)
                    Post posting = BlogEngine.Core.Post.GetPost(new Guid(Request.QueryString["id"]));

                    string theCat = "";

                    foreach (Category cats in posting.Categories)
                        theCat = cats.Title;

                    if (theCat == "YOUR CATEGORY")
                        MasterPageFile = Utils.RelativeWebRoot + "themes/Indigo/site.master";