Okt
15
2010

Installing and fixing Arthemia PRO on Blogengine 1.6.x

imageWhen I decided to build a more magazine-like blog the first challenge was to find an appropriate theme. I liked to feature several well-defined categories and wanted the opportunity to feature certain posts. At the same time I wanted to keep the overall blog without the need to build subpages.

 

I asked my facebook contacts and the tip I got was Arthemia… A quick search brought me directly to Antonio Chagoury's homepage where he offered Arthemia PRO for blogengine.net. He did a great hob porting that theme from wordpress but he tested it only on some aged versions of Blogengine. The screenshots were promising though. So I hoped for the best and downloaded the package. I unpacked it in the webroot of blogengine, changed the categories, switched the theme setting… and got frustrated.

 

First of all, my blog didn’t show the headline and the featured list most of the time (confusing enough: sometimes it did…). Secondly the article list didn’t show any teaser texts. Instead there were only the article graphics followed by the “” link. All in all this was not the theme from the screenshots.

 

So I started debugging and browsing the code.

 

It turned out that the Headline post and the featured category always showed when I directly referenced the default.aspx instead of just trusting the automatic forward… By browsing through the sourcecode I then found the following line in site.master.cs:

if (Request.QueryString.Count == 0 && 
            Request.RawUrl.Replace("?", "").EndsWith("/default.aspx", StringComparison.OrdinalIgnoreCase))

 

The problem here was that sometimes the RawURL just contained the pure address (http://www.primbs.de/). I didn’t investigate much but the following hack fixed the problem (at least on the machines I tried it with):

if (Request.QueryString.Count == 0 &&
            (Request.RawUrl.Replace("?", "").EndsWith("/default.aspx", StringComparison.OrdinalIgnoreCase)
            | Request.RawUrl.Replace("?", "").EndsWith("/", StringComparison.OrdinalIgnoreCase) )
     )

 

The second problem was to show the article excerpts. I solved it by including the following short method in PostViewFrontPage.ascx.cs and in PostViewRight.ascx (in the latter case just included in the ascx since there is no code behind file):

public string GetDescription(string content, int length, string link)
    {
        string sStripped = BlogEngine.Core.Utils.StripHtml(content);
        if (sStripped.Length <= length) return sStripped;
        else
            return content.Substring(0,length) + "... <a href=\"" + link + "\">[More]</a>";
    }

 

Then you need to change the line that fetches the description in the markup (PostViewRight.ascx and PostViewFrontPage.ascx). The line you search for is

<%= Body %>

I changed it to

<%=GetDescription(Post.Content, 300, Post.AbsoluteLink.ToString()) %>

 

In PostViewFrontPage I used 800 instead of 300…

 

I know that this is a rather dirty and lazy hack and I did not really dig down to the core of the problem… My goal was simply to get it working and for me this solution works until I have a little more time at hand. I even might refactor that theme a bit. Especially since I really would like to see a more componentized version that makes configuration a bit easier.

 

As a general conclusion: I really liked this theme! And by browsing the code I’ve seen a few things I’d love to include. For instance including support for Widgetzones would be a nice thing… What else would make sense?

Pingbacks and trackbacks (1)+

Kommentare sind geschlossen

Was soll das hier?

Das hier ist ein sogenanntes Web-Log (oder Blog) in dem Dirk Primbs sich selbstdarstellerisch, gelegentlich witzig und manchmal auch zynisch-unfreundlich über eine breite Spanne an Themen ausläßt. Von Religion über Politik bis Technik, Fernstudium und Patchwork 2.0 reicht die Bandbreite, macht da aber nicht halt. Ein Kraut-und-Rübenblog sozusagen. Trotzdem interessant, glaubt Dirk...

Bleib in Kontakt: