Rob Brooks-Bilson
Tech, Photography, Stuff
Tech, Photography, Stuff
December 6, 2005
In an effort to make the content on my blogs easier to find, I decided to create a monthly archive pod for Ray Camden's blogCFC, the software I use for my blogs. BlogCFC is very easy to extend, which makes it the perfect blogging platform for ColdFusion developers. You can download the pod here.
The new pod is simple. It creates a dropdown box containing individual months grouped by year. When a month is selected, a bit of JavaScript reloads the page with the requested content. The dropdown box only contains listings for months that contain blog posts, and it works with multi-blog installations as well.
There are a few things to note. First, because the pod is setup for internationalization, you need to add the following to your /includes/main_en_US.properties file (or equivalent):
Next, copy the new pod file, monthlyarchives.cfm to your pods directory, usually /includes/pods/. Once you've done that, add an include for the pod in your layout.cfm file (or other layout file if you've customized your implementation).
If you look at the code for the pod itself, you'll see that I included an inline query. Ideally, this should be moved inside blog.cfc itself, but since this is an extension to the core blog, I've left it in the pod for now.
If you find this pod useful, let Ray know and he might include it as part of a future blogCFC release.
12/6/05 5:20 PM
Thanks for this! This will be very handy. Probably mainly for me instead of my blog's visitors, but it will make it a lot easier to find 'that old post that talked about...'. :-)
12/6/05 5:55 PM
Thanks Jacob. I have a few more tweaks like this that I'll be releasing in the coming weeks. Little things that make the blog more useful, I hope.
12/6/05 6:00 PM
I found to 'bugs'. One I don't really think is a bug, but just my setup is different. You have cfmodule template="/blog/ in there, but for me its /blogs/. I believe Ray has some stuff in his code to get around this.
Also, I had to remove all of the dbo. from your cfquery statement, I'm on MySQL not MSSQL. :)
The pod is still showing an error, but I don't have time to keep researching it right now. I'll get back later.
12/6/05 6:01 PM
Oops, I mean you have /blogs/ in there, but I have /blog/
12/6/05 6:37 PM
Thanks Jacob, you're right. My blog layout is heavily customized and I had to modify the location of the custom layout tag and scope cache. I'll update the zip tomorrow and note in the changes in the post.
I think your other issue with mySQL may come from the function I used for the month and year. I'll investigate that as well.
12/6/05 7:34 PM
Rob,
The dropdown doesn't really work for the current month, not does it stay in the selected month after switching. Those are two basic tweaks I'd recommend.
Cheers
-Rob
12/6/05 10:45 PM
Thanks Rob! I had to make several changes to make it work for my blog such as using cfloop in place of cfoutput on the query, moving the JavaScript down into the module tags, wrapping in regular cfoutput since enablecfoutputonly is on, and change the cfmodule paths from absolute to relative.
My version is here:
http://tinyurl.com/dgaex
12/6/05 11:51 PM
Thanks guys. It's funny how many tweaks we're all having to make for our customized versions of blogCFC. Next time before I realease a mod, I'll be sure to test it against Ray's base version as well.
Rob, I'll try to add your suggestions in tomorrow as well.
4/9/06 7:49 AM
Hi,
Thanks`-`
I got this to work.
John