Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

Delicious

Summary: Insert a delicious.com user's links or tags into PmWiki
Version: 2009-10-14
Prerequisites: PmWiki 2.0.beta25
Status: Stable
Maintainers: JonHaupt, overtones99

Questions answered by this recipe

  • How can I include a tagroll or linkroll from delicious.com (formerly del.icio.us) in my wiki?
  • How can I include a tagometer badge or a network badge from delicious.com?

Description

delicious.com, the social bookmarking site, offers the use of javascript tagrolls and linkrolls to be used on blogs and other web sites. This script enables you to include those rolls in a PmWiki installation. In addition, the script allows you to include a "tagometer badge" showing how many times a page has been bookmarked using delicious.com, and offering the opportunity to save the page to the user's delicious.com bookmarks. It also includes a simple "network badge" which displays your account name, how many bookmarks you have, etc.

To use this feature, install the delicious.phpΔ script into the cookbook/ directory, then add an include_once("$FarmD/cookbook/delicious.php"); line to a local customization file.

The script can generate linkrolls (displaying some or all of your bookmarked links) and tagrolls (displaying some or all of your tags). The simplest linkroll can be created by using the markup (:linkroll user=foo:) where foo is the desired delicious username, creating a roll of 10 recent links. Similarly (:tagroll user=foo:) creates a complete tag cloud (not a list) of user foo. There are a variety of other arguments you can use to customize this per page; one can also define default parameters via $DeliciousBookmarkDefaults and $DeliciousTagDefaults (see below).

The simplest way to produce a tagometer badge or network badge is to simply type (:tagometer:) or (:deliciousbadge user=foo:), respectively.

The recipe is derived from the delicious.com help pages, specifically those related to tagrolls, linkrolls, tagometer, and network badges.

Linkroll, Tagroll, Tagometer Badge, & Network Badge Arguments:

For (:linkroll:)

  • user: delicious.com username (required)
  • number: the number of links you want to display (default: 10)
  • sort: recent or alpha (default: recent)
  • tags: Limit the linkroll by tag(s). Multiple tags use the syntax 'tag+tag'
  • icon: large, small, rss, or none (default: large)
  • title: text to display as a header (default: My Delicious Bookmarks) - due to a bug, please use title='my title' rather than title="my title"
  • showtags: true or false (default: false) - include the tags associated with each link
  • shownotes: true or false (default: false) - include the notes associated with each link
  • showname: true or false (default: false) - displays username at the bottom, with a link to user's delicious page
  • showadd: true or false (default: false) - displays link to add user to your delicious network

For (:tagroll:)

  • user: delicious.com username (required)
  • number: number of tags to display (default: empty / '')
  • sizerange: in the syntax '8-25', the lowest and highest text size used for display (default: 12-35)
  • title: text to display as a header (default: 'My Delicious Bookmarks')
  • sort: options are freq (frequency) or alpha (default: alpha)
  • flow: cloud or list (default: cloud)
  • color1/color2: color1 is the least frequent tag, color2 is the most frequent (colors are used on a gradient between color1 and color2). must use html colors, no # (aka like this: '000099')
  • counts: true or false (defaut: false) - include the frequency of each tag
  • showicon: true or false (default: false)
  • showname: true or false (default: false) - displays username at the bottom, with a link to user's delicious page
  • showadd: true or false (default: false) - displays link to add user to your delicious network
  • style: only option is style=none (default is empty) - this prevents delicious styling rules from being loaded for tagroll, and hence allows you to format tagrolls via >>right<< or other CSS calls that are otherwise overidden by the delicious formatting rules...

For (:tagometer:)

  • size: wide or tall (default: wide)
  • icon: true or false (default: true) - shows or hides delicious icon
  • timesSaved: true or false (default: true) - shows or hides # of times saved
  • graph: true or false (default: true) - shows or hides graph
  • tags: true or false (default: true) - shows or hides tag

If you'd rather just copy&paste from http://delicious.com/help/tagometer instead of using the recipe and it's various arguments, simply add something like the following to config.php before including the recipe:

$DeliciousTagometerFmt = 'yourjavascripthere';

For (:deliciousbadge:)

  • user: delicious.com username (required)
  • icon: medium, small, or none (default: medium)
  • bookmarkcount: true or false (default: true) - number of bookmarks you've collected
  • networkcount: true or false (default: true) - number of networks you belong to
  • fancount: true or false (default: true)- number of fans you have
  • showicon: true or false (default: true)
  • showname: true or false (default: true) - displays username at the bottom, with a link to user's delicious page

Again, if you'd rather just copy&paste from http://delicious.com/help/networkbadges instead of using the recipe and it's various arguments, simply add something like the following to config.php before including the recipe:

$DeliciousBadgeFmt = 'yourjavascripthere';

Defining Default Values

Default values for linkroll, tagroll, tagometer badges and network badges are already defined within the recipe, but you can define your own defaults in config.php via $DeliciousTagDefaults, $DeliciousBookmarkDefaults, $DeliciousTagometerDefaults, and $DeliciousBadgeDefaults. Just paste something like the following before including delicious.php:

  $DeliciousBookmarkDefaults = array(
	'number' => '30',
	'sort' => 'alph',
	'tags' => 'true',
	'user' => 'myUserName',
	'icon' => 'none',
	'title' => '',
	'showtags' => 'true',
	'shownotes' => 'false',
	'showname' => 'false',
	'showadd' => 'false'
  );


  $DeliciousTagDefaults = array(
	'number' => '',
	'sort' => 'alpha',
	'sizerange' => '12-35',
	'user' => '',
	'flow' => 'cloud',
	'title' => 'My Delicious Tags',
	'color1' => '87ceeb',
	'color2' => '0000ff',
	'counts' => 'false',
	'showicon' => 'false',
	'showname' => 'false',
	'showadd' => 'false'
  );


   $DeliciousTagometerDefaults = array(
	'size' => 'wide',
	'icon' => 'true',
	'timesSaved' => 'true',
	'graph' => 'true',
	'tags' => 'true'
   );


   $DeliciousBadgeDefaults = array(
	'user' => 'myAccount',
	'icon' => 'medium',
	'bookmarkcount' => 'true',
	'networkcount' => 'true',
	'fancount' => 'true',
	'showicon' => 'true',
	'showname' => 'true'
   );

CSS and Styling Example

Linkroll - It's possible to style the linkroll links in your CSS file. Info from delicious.com on this matter is available here, though their examples are spare and not well-explained. Below are some of the more commonly used CSS lines that enable one to define separate stylings for links, tags, and notes. Note that there are several more CSS classes defined than are notated here. In addition, feel free to comment out or delete the ones you don't need. Any items that you don't include will inherit the default styling of your page.

.delicious-banner, .delicious-banner a { font-size:12px; color:green; } /* style for title */
.delicious-link { color:blue; } /* color of each bookmark link */
.delicious-tag { color:red; } /* color of each tags */
.delicious-extended { color:yellow; } /* style for notes */
.delicious-even { background-color:none; display:block; } /* zebra (alternating) - EVEN */
.delicious-odd { background-color:#eee; display:inline; } /* zebra (alternating) - ODD */

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

  • 2009-10-14 - added style=none for tagrolls - removes default delicious formatting, allowing tagrolls to be formatted via CSS calls like >>right<<, etc...
  • 2009-10-05 - added more arguments (showadd, showicon, showname) to (:tagroll:). To prevent confusion, the Tagometer (which was originally called via (:deliciousbadge:)) is now called instead via (:tagometer:); (:deliciousbadge:) now refers to the Delicious Network Badge, which is now incorporated; both have various arguments. Renamed various variable names, and cleaned up the code a bit... overtones99
  • 2009-10-04: can now display notes via shownotes=true; added showadd for diplaying 'Add me to your nettwork' link, and showname to display username and link; revised (:deliciousbadge:) to permit arguments overtones99
  • 2009-10-03: re-uploaded supposed version of April 2009 (just guessing), as it appears November 2008 was what was still being offered above; fixed issue with 'title' not displaying; plus, added $DeliciousBookmarkDefaults and $DeliciousTagDefaults as SDVA's, for easy config.php declaration overtones99
  • April 2009 : Bug fixes; changed "label" to "title" in order to follow Delicious.com standards
  • November 2008 : Updated for change from del.icio.us to delicious.com; fixed bug in output for label=''
  • January 2007 (1.1) : Added the ability to include tagometer badges.
  • March 2006 (1.0) : Initial release

Comments

2006/10/02, Daniel
this addon is great, thanks!
Is there o possibility to define the links to get opened in a new window? Thanks, Daniel

I don't think del.icio.us provides this option; since the links are sent on the fly by del.icio.us's database, we're sort of forced to use whatever code they send. I think the thinking at the moment is that browsers offer the option of opening links in a new window or tab, so it's unnecessary to force the user to do it one way or another. I think using CSS you might be able to tweak it somehow, but I'm really not sure how you'd do that. - JonHaupt
note that this is something that has been requested by the Delicious community (http://support.delicious.com/forum/search.php?PostBackAction=Search&Keywords=link+new+window&Type=Topics&btnSubmit=Search(approve links)), but has not yet been delivered. however, Delicious staff have indicated ((http://support.delicious.com/forum/comments.php?DiscussionID=1999&page=1#Item_0(approve links)) that they will likely provide this functionality in a future version of their software. for now, it appears there is a javascript hack (http://support.delicious.com/forum/comments.php?DiscussionID=1186&page=1#Item_5(approve links)) that rewrites all links with target=_blank appended... - overtones99

2007/02/14, Tobias
Unfortunately the tagometer badge treats http://mysuperwiki.com and http://mysuperwiki.com/index.php/Main/Homepage as two different URIs and thus display differing information. Is there a way to prevent this?

I believe this is a limitation of del.icio.us, as it doesn't know how to tell that those two urls are the same thing. I think the only way to avoid this is to make sure that the URI is always one or the other--perhaps by using a rewrite rule. It seems like probably the second one is safer, so you could rewrite all of the first one to the second one. otherwise, it's up to del.icio.us to become a smarter system. -j

2007/04/07, Mark
Very cool. I have been meaning to find add this.

Question though, if I just want to show the tagometer badge but not the tags or person count, just the clickable image. Thanks. Mark

2009/08/18 st
Hello there!
I want use multiple tags, but combined. Display all Links tagged with 'Tag1' or 'Tag2'...no limit ;-)
tags: Limit the linkroll by tag(s). Multiple tags use the syntax 'tag+tag'
thx for solution!

2009/10/03a overtones99 this recipe is fabulous! thank you jon (and delicious). this is totally going to revolutionize the way i share bookmarks!

i noticed that it's possible to style the links in my css file. info from delicious is available here: http://delicious.com/help/linkrolls/css ... but here are some of the most valuable CSS lines i plan to use Note that there are more than are notated below; feel free to just comment out or delete the ones you don't need. Any items that you don't include will assume the default styling of your site:

.delicious-banner, .delicious-banner a { font-size:12px; color:green; } /* style for title */
.delicious-link { color:blue; } /* color of each bookmark link */
.delicious-tag { color:red; } /* color of each tags */
.delicious-extended { color:yellow; } /* style for notes */
/* zebra (alternating bgcolors) - EVEN */
.delicious-even { background-color:none; display:block; }
/* zebra (alternating bgcolors) - ODD */
.delicious-odd { background-color:#eee; display:inline; }

2009/10/03b overtones99 it appears that an older version of the delicious recipe from 11/2008 was the version that was last uploaded, instead of the 4/2009 version - i noticed that the label-to-title bug had not been fixed. i fixed what i thought was probably the bug, and reuploaded it here as delicious-2009-10-03b.phpΔ, and in place the link for the current recipe for this page as well. i hope that's alright. might want to double-check.

one thing i cannot yet figure out: when adding a title, it seems to prefer it as title='my title' (single quotes), and not as title="my title" (double-quotes). i get gibberish printout with the latter. ??

and finally, i decided to make the defaults available via SDVA, so that folks can set their own defaults in their config.php. this can now be done via $deliciousTagDefaults and $deliciousBookmarkDefaults if pasted before including the delicious code, like so:

  $deliciousBookmarkDefaults = array(
    'number' => '30',
    'sort' => 'alph',
    'tags' => 'true',
    'user' => 'myAcct',
    'icon' => 'none',
    'title' => '',
    'showtags' => 'true',
    'shownotes' => 'false',
    'showname' => 'false',
    'showadd' => 'false'
  );

2009/10/04 overtones99 - With delicious-2009-10-04b.phpΔ, one can now display notes via shownotes=true. plus, added showadd and showname - two items i will probably never use, but delicious offers them so adding them in anyways. Also updated (:deliciousbadge:) to include arguments.

See Also

Contributors

User notes?: If you use, used or reviewed this recipe, you can add your name. The following format is recognized:
* (+) Optional positive comment. Name, date
* (-) Optional negative comment. Name, date

These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on October 15, 2009, at 04:49 AM