Roller Bug: Issue With Using $url and Blog Categories
Bug Description
While working on my recently released Orange Flower template I discovered a bug with the macro #showWeblogCategoryLinksList when displaying sub-categories (recursive or otherwise). Links, when rewritten, have the forward slash character / rendered as %2F. Because of this the browser won't evaluate the path properly; thus resolving a 404.
With some more digging I discovered that the issue was really with the function $url.category(catPath::String). It was inserting a %2F for any evaluated category path. The #showWeblogCategoryLinksList must rely on this function for building it's list.
Getting Around the Bug
I still wanted to be able to list sub-categories (and have them link properly), so I found a work around. It involves building the URL yourself. This is the code I used:
<div id="templates" class="sidebarbox">
<h4>Templates</h4>
#set($templatesCategory = $model.weblog.getWeblogCategory("Templates"))
<ul class="rCategory">
#foreach($category in $templatesCategory.weblogCategories)
<li><a href="/$model.weblog.handle/category$category.path">$category.name</a></li>
#end
</ul>
</div>
Line 3 gets a reference to the weblog category that we want to display the subcategories of. In this case it is Templates
Line 5 loops through each subcategory in the parent category and acquires a reference to it via $category.
Line 6 builds our url in the form /handle/category/catPath. $model.weblog.handle gets the string value of the handle of your blog, in my case it is "jrbethke". /category moves us into the category directory. We then concatenate the path to the category that is acquired via $category.path
There are a couple of ways to get around this and I played with several of them, but this seems to be the cleanest solution. Aside from being able to use the #showWeblogCategoryLinksList macro the way it was meant to be used. I looked around on the net to see if I could find any other reports of this bug, but didn't find anything.
Please post your thoughts on this topic.
Hi Jesse,
I have an Apache question for you from the Democratic blog. I have an audio file I would like to put on the blog but I do not know how to do it. Do you know how by chance? Thanks.
Posted by RCDEM on February 05, 2008 at 10:39 PM CST #