Web Development

Rate Link Patch

I mentioned last week that I added a "rate this post" feature to my blog using the Drupal fivestar module.

There is a serious usability issue with this module. If you don't show the rating widget on the article teaser then visitors probably won't know there is a rating feature, and so there may not be a lot of rating activity. (The teaser is the first few paragraphs of the entry, displayed on the blog page.)

Comments work similarly to ratings. You have to click through to the full article to leave a comment, just as you do a rating. This, however, doesn't present the same problem as article ratings. First, visitors tend to know that if a blog supports comments, you have to click through to the full article to access the comments. Article ratings aren't a common feature, so visitors don't expect them.

Sidebar Block Plugin for Smarty Templates

HTML templates allow presentation to be abstracted from control. Abstraction, like water, is good—but be careful or you'll drown.

Take sidebar blocks. HTML templates make it easy to abstract the sidebar, but what about the individual blocks?

You could make each block its own template, but you end up juggling so many miniscule pieces you lose track of all the bits. Do you really need a dedicated template just to put an RSS icon in a box?

On the other hand, if you eschew templates and code the blocks all up in the sidebar, you get a large unstructured mess of HTML.

What we need to do here is abstract the structure, not all the little bits of content.

The Smarty template system for PHP has a good solution. You can use the plugin mechanism to create a custom template tag such as {block}. That makes it easy to place blocks in a sidebar template in a structured fashion. I did this for the Holidailies web site.

Here is how a sidebar block looks on Holidailies:

a sample sidebar block from the Holidailies web site

Syndicate content