Date:Monday Aug 11, 2008

Roller Weblogger improved blogroll display code for use with icons and images


Here's some code that improves on the default Roller Weblogger blogroll code to ensure that if you include an image / icon for your blogroll entries it displays the image and the blogroll entry name (good if your using icons).

Using the default roller macro for displaying your blogroll means that no text is displayed if an image / icon URL is given. The default behaviour leaves rather empty lists of course, so I see this as an improvement.

So this code is effectively a replacement for "#showBookmarkLinksList($rootFolder false false)", although it still uses the same CSS notation for lists, so as not to disturb your design.

It works with specific blogroll folders, so you do need to dictate which one your going to display (in the example below it's "/My Blog Roll"). However this could be improved further to pick up the current folder name if you were to cycle through the sub folders (but I didn't need it to do that, so I haven't).


#set($rootFolder = $model.weblog.getBookmarkFolder("/My Blog Roll"))
#if ($rootFolder.bookmarks.size() > 0)
    <h2>My Blog Roll</h2>
    <ul class="rFolder">
    #foreach ($bookmark in $rootFolder.bookmarks)
    <li class="rFolderItem"><a href="$bookmark.url"><img alt="$bookmark.name" border="0" src="$bookmark.image" class="rBookmark" /></a>&nbsp;&nbsp;<a href="$bookmark.url">$bookmark.name</a></li>
    #end
    </ul>
#end



Online

Flickr

www.flickr.com

Where

Search

This blog only

Related

Language

Archive

Subscribe

 

Do the right thing

Join the Blue Ribbon Online Free Speech Campaign
Join the Online Free Speech Campaign!

kthxbai

Visitors

Locations of visitors to this page
  • » Large Cluster Map
  • » Unique Visitors:
  • Today's Page Hits: 540