Welcome to Geeklog, Anonymous Thursday, November 21 2024 @ 03:31 pm EST
Geeklog Forums
Add a "Save to Delicious" link to the Links plugin
Status: offline
Dirk
Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Here's a little hack I made a while ago and completely forgot about: The idea is to add a little "Save to Delicious" link next to the links listed in the Links plugin.
We need 2 new variables for that. Open public_html/links/index.php and in function prepare_link_item, add the 2 lines as pointed out below:
$template->set_var ('link_actual_url', $A['url']);
$template->set_var ('link_actual_url_encoded', urlencode($A['url'])); // <-- add this line
$template->set_var ('link_name', stripslashes ($A['title']));
$template->set_var ('link_name_encoded', urlencode(stripslashes ($A['title']))); // <-- add this line
Then, open plugins/links/templates/linkdetails.thtml and add the link to Delicious, e.g. like so (this is the complete file):
<strong>{link_html}</strong> ({link_hits}) <span><a href="http://delicious.com/save?url={link_actual_url_encoded}&title={link_name_encoded}" title="Save to Delicious"><img src="{site_url}/images/icons/delicious.small.gif" alt="[Delicious]"></a></span> {edit_icon} {link_broken}<br{xhtml}>
{link_description}
</li>
I've downloaded the delicious.small.gif icon from here: http://static.delicious.com/img/delicious.small.gif and put it into the site's public_html/images/icons directory.
Now you see the Delicious icon next to every link in your Links section. Clicking on it will take you to Delicious where, assuming you have an account, it will let you save it to your bookmarks. The title is automatically filled in from the title in the Links plugin.
Have fun.
bye, Dirk
P.S. The 2 new variables will also be built into the next Geeklog release.
We need 2 new variables for that. Open public_html/links/index.php and in function prepare_link_item, add the 2 lines as pointed out below:
Text Formatted Code
$template->set_var ('link_url', $url);$template->set_var ('link_actual_url', $A['url']);
$template->set_var ('link_actual_url_encoded', urlencode($A['url'])); // <-- add this line
$template->set_var ('link_name', stripslashes ($A['title']));
$template->set_var ('link_name_encoded', urlencode(stripslashes ($A['title']))); // <-- add this line
Then, open plugins/links/templates/linkdetails.thtml and add the link to Delicious, e.g. like so (this is the complete file):
Text Formatted Code
<li><strong>{link_html}</strong> ({link_hits}) <span><a href="http://delicious.com/save?url={link_actual_url_encoded}&title={link_name_encoded}" title="Save to Delicious"><img src="{site_url}/images/icons/delicious.small.gif" alt="[Delicious]"></a></span> {edit_icon} {link_broken}<br{xhtml}>
{link_description}
</li>
I've downloaded the delicious.small.gif icon from here: http://static.delicious.com/img/delicious.small.gif and put it into the site's public_html/images/icons directory.
Now you see the Delicious icon next to every link in your Links section. Clicking on it will take you to Delicious where, assuming you have an account, it will let you save it to your bookmarks. The title is automatically filled in from the title in the Links plugin.
Have fun.
bye, Dirk
P.S. The 2 new variables will also be built into the next Geeklog release.
19
14
Quote
Status: offline
1000ideen
Forum User
Full Member
Registered: 08/04/03
Posts: 1298
Would it be possible to get instructions how to put this under a story in GL 1.6.0 ? Maybe also with Twitter http://twitthis.com/tools :
19
18
Quote
All times are EST. The time is now 03:31 pm.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content