WebReference.com - Part 2 of Chapter 7 from Essential Blogging. From O'Reilly (5/5).
Essential Blogging, Chapter 7: Advanced Radio UserLand
People who read your blog will vary from everyday readers to occasional browsers. If you blog frequently, you may find that those occasional readers are penalized by the sequential, newest to earliest, nature of blogs. To make this easier for readers, you can add the Recent Posts macro to your blog. The Recent Posts macro lists the titles of recently added posts. You must have titles enabled (see Chapter 4) to use the Recent Posts macro. Figure 7-9 shows the Recent Posts macro in action.
Like many Radio macros, the Recent Posts macro (actually called
radio.macros.recentTitledBlogPosts) can be called with parameters. In the case of this macro, the parameters specify how many posts to display, whether to truncate titles, and so on. The five parameters, all of which are optional, are listed with their default values in Table 7-1.
|maxPosts||25||Maximum number of posts to display|
|maxTitleLength||(infinite)||Maximum length of title (titles will be truncated to this length)|
|flIncludeWhen||true||List the dates of the posts as well as their titles|
|Catname||""||Category of posts (empty string means all)|
|cellSpacing||0||Cell spacing for the table|
So to display a Recent Posts list, but truncate the titles at 50 characters, you'd use:
To raise the number of posts to 50:
To add 5 pixels between each line in the post lists and between the title and the data (i.e., set the
cellspacing attribute of the HTML table that displays the posts):
To give 10 posts a title length of 50 characters, with no dates and 5 pixels of cell spacing:
<%radio.macros.recentTitledBlogPosts (maxPosts:50, maxTitleLength:50, flIncludeWhen:false, cellSpacing:5)%>
To add this macro to your template underneath your calendar:
Update your Radio.root file as described earlier in Chapter 3.
Click on the Prefs link in the Radio command bar.
In the Templates group of links, click on the Home Page template.
Find the call to
<%drawcalendar ( )%>.
Add the Recent Posts macro after the call to
drawcalendar. Exactly where to put it in the HTML depends on the template you're using. For example, in the Default template, the calendar is part of a table with your navigation links and various Radio and XML icons. In this case, it's best to put the Recent Posts list outside that table. In the Woodlands theme, the icons and links are elsewhere, so you can simply put the Recent Posts macro call immediately after the
Click on Submit to save your template.
Reload your blog's home page and you should see the Recent Post list. Figure 7-10 shows the Recent Posts list added to the Default theme.
If you find that the macro's output doesn't appear on your blog, one of two things is probably wrong. An error message from Radio probably indicates a syntax error-check that you haven't mistyped the
% characters or mistyped the macro or its arguments. If you just don't see a change, your changed post probably hasn't been upstreamed yet-wait a few seconds and try again. If it still doesn't work, check your network connectivity and look at the Events log in Radio.
There are many different macros for Radio templates: some from UserLand, some from individual developers, and some from third parties. Different types of macros include the very popular GoogleBox, picture galleries, image uploaders, and more. Locate these macros via these directories:
Although adding macros to an existing Radio template is relatively easy if you are comfortable with HTML, it is actually quite difficult to create an entire theme. A third-party product for Radio, themeTool, lets you create your own themes using standard web development tools such as DreamWeaver or FrontPage. More information is available from:
Created: October 14, 2002
Revised: October 14, 2002