Wiki source for DeliciousAction


Show raw source

=====Del.icio.us Bookmark Action=====

>>==See also:==
~-WikkaFolksonomy
~-UnderDevelopment
>>This is the development page for the del.icio.us action.::c::

===Documentation===

==Short description==
Display a del.icio.us bookmark link for the current page.

==Parameters==
This action currently does not accept any parameter.

==Long description==
This simple action displays a link to bookmark the current page at [[http://del.icio.us del.icio.us]]. It can be used as a stand-alone plugin in the page body or as a [[WikkaMenulets menulet]] in the page header/footer. It retrieves the title from the page body (unicode supported). Obviously, you must be registered at del.icio.us in order to be able to bookmark a page.

==Usage:==
##""{{delicious}}""##

==Example:==
""<a style="border:1px dotted #999; height:10px; color:#666; text-decoration:none; font-size:.7em" href="http://del.icio.us/post?url=http%3A%2F%2Fwikka.jsnx.com%2FDeliciousAction&title=%0A%09%0A%0ADel.icio.us+Action" title="Bookmark this page at del.icio.us"><img src="images/icons/logos/del.icio.us_small.png" /> Post to del.icio.us</a>""

===The code===
Save the following as ##actions/delicious.php## and modify the ICON_PATH constant to match the path to the icon on your server. The del.icio.us icon used on this server can be downloaded [[http://wikka.jsnx.com/images/icons/logos/del.icio.us_small.png here]].

%%(php;1)
<?php
/**
* Display a link to bookmark the current page at del.icio.us
*
* @package Actions
* @name Del.icio.us
*
* @author {@link http://wikka.jsnx.com/DarTar Dario Taraborelli}
* @copyright Copyright © 2005, Dario Taraborelli
* @version 0.1
* @since Wikka 1.1.X.X
*
* @access public
* @uses PageTitle()
* @uses Href()
* @output bookmark link with urlencoded page URL and title
*
* @todo move style to Wikka stylesheet
* @todo add support for "tag" URL parameter
*
*/

/* Constants section */
define('ICON_PATH', 'images/icons/logos/del.icio.us_small.png');
define('STYLE', 'border:1px dotted #999; height:10px; color:#666; text-decoration:none; font-size:.7em');
define('DELICIOUS_BASE_URL', 'http://del.icio.us/post?url=');

/* i18n */
define('LINK_TEXT', 'Post to del.icio.us');
define('LINK_TITLE', 'Bookmark this page at del.icio.us');

//build bookmark link
$url = $this->Href();
$title = $this->PageTitle();
if (isset($url) && isset($title)){
$delicious = DELICIOUS_BASE_URL.urlencode($url).'&title='.urlencode($title);
$icon = '<img src="'.ICON_PATH.'" />';
$output = '<a style="'.STYLE.'" href="'.$delicious.'" title="'.LINK_TITLE.'">'.$icon.' '.LINK_TEXT.'</a>';
echo $output;
}
?>
%%

----
CategoryDevelopmentActions
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki