Tutorial: The Archive Cloud
From time to time I get a question regarding this or that feature on my website. The one feature I've had the most questions about the last couple of months are my 'Archives' (or now called 'History'). It has two distinct characteristics, namely the fact that it seems to be a separate page and of course the the 'Tag Cloud'-like layout. Well time to add some content to this weblog, here is the snippet and combining tutorial on how to implement your own 'Archive Cloud'.
Archive Cloud Snippet
The current snippet is only able to build an 'archive cloud' on a monthly basis, where each year gets its own cloudy paragraph. Just like my current 'History' page. Let's start of by downloading the snippet, unzipping it and uploading the file to the extensions/snippets/ directory in your weblog folder. When the 'Use folder names' (or similar) option is enabled during extraction, the directories will automagically be created.
snippet_archivecloud_20070215.zip
The Archives Template
Next to the snippet we will also need a new template for the archives page. The easiest way to create one is to copy/paste the code from your original frontpage template to a new file (i.e. archivesfrontpage_template.html) and replace the [[subweblog]] tag with the following:
[[archivecloud]]
<div style="display:none;">[[subweblog:archivecloud]]</div>
Next save your template as archivesfrontpage_template.html and/or upload it to your pivot/templates directory. Remember the filename of your new template, we will need it later on.
New Weblog
Alright, now the snippet and the new template are in position we are going to create a new weblog (Administration -> Weblogs -> New Weblog). This weblog will take over the archiving function for your original weblog, so change the latter archiving settings on page 1 to 'No Archives'. While you are at it, you might as well keep the settings of the original weblog open in a separate tab or window so it will be easy to duplicate the settings to the archive weblog. Most of these settings will be the same, there are some exception however, read on...
Page 1
Page 1 of your weblog settings. Here are the settings that need to be considered and changed. The others can be the same as your original weblog. Your choice.
- Weblog name & Payoff: Depending on where you use the [ [weblog(sub)title] ] tags in your templates, you will probably want this to be almost the same as your original weblog title, except for a hint that your visitor is looking at the archives of your weblog.
- Front page (Index): The filename the generated page will be written to, something like archives.php will do.
- Live Entries: If you have set this option to 'No' in your original weblog (see your other window or tab, remember?) then you will have to make sure here to use a different filename, i.e. entryarchive_%1.php.
- Archive Settings: Set this option to 'Monthly Archives'!
- Frontpage Template: Set this option to the frontpage template for your archives you just created above.
- Archivepage Template: The template you choose here will determine what your monthly archive page looks like. The page people see when they click on a specific month. For now just choose the same template as in your original weblog.
Next! Page 2
Depending on the number of [[subweblog]] tags in your template a number of sections will turn up here. Find the one named 'archivecloud' and change the following:
- Shortentry Template: The template you will select here, defines what each entry will look like on the monthly archive pages. The one the visitor sees after clicking on a month in the archive cloud.
- Number of entries: 1
- Offset: 'Empty', zero, nothing, nada!
- Publish these categories: Enable all categories here you want archived by the cloud. Probably the same categories which are enabled in the original weblog settings.
Next! Page 3, almost done
Again, in general you want the same settings here as for your original weblog. This is especially the case for the formattings of comments, dates, trackbacks etc. Check and compare this page at least twice with your original weblog settings, you'll probably overlook some settings... I did. The following settings need special attention:
- Generate feeds: Set this one to 'No', you're probably already generating those in your original weblog.
- Send mail?: If you are using this option to be notified when someone leaves a comment, than also set this option to 'Yes' over here.
That's it, you are done. 'Rebuild all files' and everything should be working, almost...
Almost done
Don't forget to actually link to the 'Archive Cloud' somewhere on your weblog. So go edit those templates and add something like:
<a href="[[log_dir]]archives.php">Archive Cloud</a>
Where archives.php is ofcourse the filename you entered on page 1 for the 'Front page (Index)' setting. Also add the following to your CSS file so the cloud actually looks like a cloud instead of a bullet list:
.archivecloud { padding: 0; }
.archivecloud LI { display: inline; }
.archivecloud SPAN { position: absolute; left: -999px; width: 990px; }
The range for the font sizes of the cloud can be altered using three snippet parameters.
[[archivecloud:minFontSize:maxFontSize:fontSizeUnit]]
The default values for the parameters are '100', '200' and '%' respectively, resulting in font sizes varying between 100 and 200 percent of the inherited font size. If you want font sizes to vary between 12 and 24 pixels, use the following in your template:
[[archivecloud:12:24:px]]
And that's really that! You now have yourself a true 'Archive Cloud', congrats. If there are any questions left, do not hesitate to leave a comment!

Only 1 comment
Thanx….When I have some spare time on my hands I will look into this one :-D