Newbie Tip: Category Link Macro – How to Install and Use
You can download the macro here: Item Categories Macro (by right clicking on the link if you have windows and saving target as “the default name” on to your hard drive – I usually save it on my desktop easy to find when you go to install it)
How to install this script into your Radio.root:
You will then need to install it into Radio. Bring your Radio application to the front.(right click on your radio icon in your system tray – windows users – an click on open radio) From the ‘File’ menu choose ‘Open…’ and then select the newly downloaded script. A box will open, asking “Name for imported object?” and “workspace.itemCategories” will be displayed in the text box. Click OK to install the script. You will then see the script in a window.
Click Compile, then close the window. (Advanced Users: Or take a look at the code if you want to see what is under the hood, then close the window.) The macro is now ready to use.
Usage – The following code should be used in the #itemTemplate: (copy and paste the following code into your #itemTemplate)
<%workspace.itemCategories (<%itemNum%>, separator:”, “)%>
Here is what my #itemtemplate looked like before I added the category link macro:
<table width=”100%” cellpadding=”1″>
<tr>
<td valign=”top”>
<br><div class=”itemTitle”><b><%itemTitle%></b></div><%itemText%><br>
<font class=”small” size=”-1″ color=”gray”><%when%> <%permalink%> <%commentLink%> <%trackbackLink%></font>
</td>
<td valign=”top” align=”right” nowrap>
<%enclosure%>
</td>
</tr>
</table>
Here is what it looked like after I added the category link macro
<table width=”100%” cellpadding=”1″>
<tr>
<td valign=”top”>
<br><div class=”itemTitle”><b><%itemTitle%></b></div><%itemText%><br>
<font class=”small” size=”-1″ color=”gray”><%when%> <%permalink%> <%commentLink%> <%trackbackLink%> <br><%workspace.itemCategories (<%itemNum%>, separator:”, “)%></font>
</td>
<td valign=”top” align=”right” nowrap>
<%enclosure%>
</td>
</tr>
</table>
I also added a break <br> to the next line for my category macro
Opening your #itemTemplate
1. either right click on your radio icon again and click on open www folder, you will see your #itemTemplate in this folder, double-click on it and it will open on a notepad text format (if you open it this way, once you insert the macro, click on file > save)
OR
2. go to the PREFS > TEMPLATES > ITEM TEMPLATE from the Radio Desktop Website (if you open the #itemtemplate this way, click on submit after you insert the macro)
Additional Notes on the Macro and Separator Options
Parameters: <%itemNum%>: Required. This is how the macro knows what post to get the list of categories for. (just information regarding the macro and how it works – you don’t need to do anything)
Separator: Optional. Defaults to “, “. Characters and/or HTML to be inserted between each item category if there is more than one. Separator is *not* appended after last item category listed. Some examples : “, ” ” | ” “ ” “<br>” (you can change the separator of the categories you happen to list more than one for the post, it currently defaults to “,” if you want to change the separator:
macro as is: <%workspace.itemCategories (<%itemNum%>, separator:”, “)%>
if you want the separator to be “|” then copy this macro into your #itemtemplate:
<%workspace.itemCategories (<%itemNum%>, separator:”| “)%>
if you want the separator to be just a space between the categories listed then copy this macro into your #itemtemplate:
<%workspace.itemCategories (<%itemNum%>, separator: “ ”)%>
or if you want the separator to be just a break between the categories listed then copy this macro into your #itemtemplate:
<%workspace.itemCategories (<%itemNum%>, separator: “<br>;”)%>