Tweaking BlogCFC: Theme Management

Preview of the Theme Management section in the BlogCFC Administrator.One of the really nice things about Wordpress is that it has a very easy to use admin for managing your blog's theme. Working with the design in BlogCFC is a pain: the design is integrated into the actual code for the blog. Further, the code for designs is strewn through a number of different folders (includes/, images/, tags/, includes/pods/, etc.), which makes it hard to fully update a design. I've made the necessary changes to make BlogCFC handle custom theming as easily as Wordpress: click more to see the details.

 


BlogCFC Tweaks: Bug Fix for viewByCategory.cfm

I recently posted a blog entry with some code and instructions to allow drilling down into categories to view the posts in that category. Unfortunately, it had a bug. The meat of the viewByTemplate.cfm file should look like this:


<cfmodule template="../tags/datatable.cfm" data="#entries#" editlink="entry.cfm" label="Entries"
         linkcol="title" defaultsort="posted" defaultdir="desc">

    <cfmodule template="../tags/datacol.cfm" colname="title" label="Title" />
    <cfmodule template="../tags/datacol.cfm" colname="released" label="Released" format="yesno"/>
    <cfmodule template="../tags/datacol.cfm" colname="posted" label="Posted" format="datetime" />
    <cfmodule template="../tags/datacol.cfm" colname="views" label="Views" format="number" />
    <cfmodule template="../tags/datacol.cfm" label="View" data="<a href=""#application.rooturl#/index.cfm?mode=entry&entry=$id$"">View</a>" sort="false"/>
</cfmodule>

Notice the missing "querystring" attribute on the datatable module. If you don't remove that bit, clicking on a blog post link from the category view wont take you to that blog post at all. I've updated the code in the relevant zip.

 

BlogCFC Tweaks: View Entries By Category

With BlogCFC, there isn't an easy way to browse your entries by category. The closest you can get is to go to Entries put the category into the search. This actually wasn't too hard, once I figured out some of the more cryptic bits of some of the custom tags in BlogCFC.

 

BlogCFC Tweaks: Easier Category Selection

I've talked about it before, but I find classic multi-selects in HTML to be really hard to use. You invariably have to end up putting some explanation text to let a user know how to select more then one, and its easy to clear your selections everything while trying to select an additional item. I put these ideas into practice in BlogCFC to help with category selection. I replaced the following code in admin/entry.cfm starting at line 391:

<cfif allCats.recordCount>
    <select name="categories" multiple size=4 class="txtDropdown">
    <cfloop query="allCats">
        <option value="#categoryID#" <cfif isDefined("form.categories") and listFind(form.categories,categoryID)>selected</cfif>>#categoryName#</option>
    </cfloop>
    </select><br>
</cfif>

With this code:

<cfif allCats.recordCount>
    <ul class="multiselect">
        <cfloop query="allCats">
            <li><input id="cat_#categoryID#" type="checkbox" name="categories" value="#categoryID#"<cfif isDefined("form.categories") and listFind(form.categories,categoryID)> checked="checked"</cfif>/><label for="cat_#categoryID#">#categoryName#</label></li>
        </cfloop>
    </ul>
</cfif>

I also added the following code the admin style sheet ( /includes/admin.css ):


ul.multiselect {
    height: 100px;
    width: 225px;
    border: 1px solid silver;
    list-style-type: none;
    padding-left: 3px;
    overflow: auto;
}
ul.multiselect li label {
    display: inline;
    padding-left: 2px;
}

That makes it a lot easier to keep track of categories without messing something up.

 

BlogCFC Tweaks: Post Releaser Scheduled Task

I've been slowly accumulating a few tweaks to BlogCFC that make my life a little easier. The first is a schedule task I created to help me with my problem of writing 10 posts one day, but then none for a week.


<cfquery name="qryEntries" datasource="myblogds">
    SELECT TOP 1 id
    FROM tblBlogEntries
    WHERE blog = 'myblogname'
    AND released = 0
    ORDER BY posted ASC
</cfquery>

<cfif qryEntries.recordCount>
    <cfquery name="qryUpdateEntries" datasource="myblogds">
        UPDATE tblBlogEntries
        SET released = 1,
            posted = GETDATE()
        WHERE id = <cfqueryparam value="#qryEntries.id#" cfsqltype="cf_sql_varchar" />
    </cfquery>
</cfif>

I set this up to run once a day, fairly early in the morning. With this setup, all I have to do is make sure that I mark my posts as not released, and they will be parceled out one at a time to help keep my blog fresh.

 

BlogCFC Broke

So, recently my install of the blog CFC client for this section broke and started kicking a really weird error. I tried fixing it by reinstalling the client, which failed... so I dumped a fresh org/... folder in as well, which caused me to have to update my database because my blog was out of date...

Blarg. Now my old theme is gone for this site.

 

More Entries

Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me on LinkedIn.