1 captsolo Sep 19, 2004 22:41
3 holger Mar 06, 2005 00:30
There is a del.icio.us-to-wordpress plugin:
http://heisel.org/blog/2005/03/03/del2wp/
Maybe that's inspiring for somebody?
I'd like to have a "b2evo.li.cio.us", too! You know, a del.icio.us-to-b2evolution-thing...
holger
4 waltercruz Mar 07, 2005 17:07
Well.. I made a simple teste here...
Parse a RSS with magicpie it?s easy .. And the delicious to wordpress uses magpie..
O put a simple example, almost all from the magpie source..
The script gets a RSS feed and show 4 random entries.
The source (uses magpie)
<?php
define('MAGPIE_DIR', '../');
require_once(MAGPIE_DIR.'rss_fetch.inc');
$url = $_GET['url'];
function shuffle_me($shuffle_me, $howmany) {
$randomized_keys = array_rand($shuffle_me, count($shuffle_me));
foreach($randomized_keys as $current_key) {
$shuffled_me[$current_key] = $shuffle_me[$current_key];
}
$shuffled_me = array_slice($shuffled_me, 0, $howmany);
return $shuffled_me;
}
// shuffle_me get from http://br2.php.net/manual/en/function.shuffle.php
if ( $url ) {
$rss = fetch_rss( $url );
$rss->items = shuffle_me($rss->items, 4);
echo "Channel: " . $rss->channel['title'] . "<p>";
echo "<ul>";
foreach ($rss->items as $item) {
$href = $item['link'];
$title = $item['title'];
echo "<li><a href=$href>$title</a></li>";
}
echo "</ul>";
}
?>
This script will get 4 random entries from a RSS.. <br />
Try, by example with this URL: <b>http://del.icio.us/rss/waltercruz</b>
<form>
RSS URL: <input type="text" size="30" name="url" value="<?php echo $url ?>"><br />
<input type="submit" value="Parse RSS">
</form>
A exemple running: http://waltercruz.com/devel/magpie/scripts/delicious.php
I think that is not hard put ths SQL?s :)
5 dan May 16, 2005 20:52
I'm using the following right now.
1) Changed _main.php:
<?php // -------------------------- LINKBLOG INCLUDED HERE -----------------------------
// - I'm using del.icio.us instead
// require( dirname(__FILE__).'/_linkblog.php' );
// -------------------------------- END OF LINKBLOG ---------------------------------- ?>
<?php // -------------------------- del.icio.us BOOOKMARKS INCLUDED HERE ---------------
require( dirname(__FILE__).'/_delicious.php' );
// --------------------------------- END OF del.icio.us BOOOKMARKS ---------------------- ?>
2) Added Magpie to my PHP includes (actually, using .htaccess).
3) Created _delicious.php:
<?php
/**
* This is the template that displays a selection of del.icio.us links
*
* This file is not meant to be called directly.
* It is meant to be called by an include in the _main.php template.
*
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
*
*/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
define('MAGPIE_CACHE_ON', 1);
define('MAGPIE_CACHE_DIR', '{SPECIFY YOUR DIR HERE}');
//define('MAGPIE_DEBUG', 2);
require_once('rss_fetch.inc');
$url = 'http://del.icio.us/rss/yabfog';
$urllink = 'http://del.icio.us/yabfog';
$numitems = '15';
function shuffle_me($shuffle_me, $howmany) {
$randomized_keys = array_rand($shuffle_me, count($shuffle_me));
foreach($randomized_keys as $current_key) {
$shuffled_me[$current_key] = $shuffle_me[$current_key];
}
$shuffled_me = array_slice($shuffled_me, 0, $howmany);
return $shuffled_me;
}
// shuffle_me get from http://br2.php.net/manual/en/function.shuffle.php
function getDelicious($url, $urllink, $numitems) {
if ( $url ) {
$rss = fetch_rss( $url );
if (!(count($rss->items) > 0)) {
echo '<div class="bSideItem">Error: Could not fetch del.icio.us rss feed.</h3></div>';
}
else {
$rss->items = shuffle_me($rss->items, $numitems);
echo '<div class="bSideItem"><h3>Random Selection of Bookmarks from <a href="'.$urllink.'">' . htmlentities($rss->channel['title'], ENT_COMPAT) . "</a></h3>\n";
echo "<ul>\n";
echo '<li>An <img alt="RSS 1.0/RDF" src="../../img/rss_small.png" class="middle" /> feed of these links is available at <a href="'.$url.'">'.$url."</a>.</li>\n";
foreach ($rss->items as $item) {
$href = htmlentities($item['link']);
$title = htmlentities($item['title'], ENT_COMPAT);
$keywords = explode(" ", (htmlentities($item['dc']['subject'], ENT_COMPAT)));
$listitem = "<li><a href=\"$href\">$title</a><span style=\"font-size:7pt;\"> (";
foreach ($keywords as $keyword) {
$listitem .= '<a href="http://del.icio.us/tag/'.$keyword.'" target="_blank">'.$keyword.'</a> ';
}
$listitem = rtrim($listitem) . ")</span></li>\n";
echo "$listitem";
}
echo "</ul>\n</div>";
}
}
}
getDelicious($url, $urllink, $numitems);
if (MAGPIE_DEBUG) {
?>
<pre>
<?PHP var_dump($rss); ?>
</pre>
<?
}
?>
4) Finished product: [url=http://www.yabfog.com/blog/]YABFOG[/url]
--
6 dan May 18, 2005 17:19
I modified the code a bit to fix a couple of mistakes (missing quotes aroung the href :oops:) and htmlentity encode the feed title, link title and list of keywords.
Also, the cache is working just fine.
7 dan May 26, 2005 04:39
Dan wrote:
I modified the code a bit to fix a couple of mistakes (missing quotes aroung the href :oops:) and htmlentity encode the feed title, link title and list of keywords.
Also, the cache is working just fine.
I've edited my post above with the full code I'm using now.
Features (recap and update):
Uses Magpie to fetch and cache the del.icio.us feed
Proper error checking of the fetch
Adds a link to the raw feed (but beware the IMG that you are likely missing!)
[*]For each bookmark, provides a link to the del.icio.us tag page for each associated keyword[/list:o]
8 waltercruz May 27, 2005 21:52
Realy good :)
Thank you - my code was absolutely experimental
BTW, the delicious itself has a api. Look: http://del.icio.us/doc/api
9 dan May 27, 2005 23:23
Thank you! :D Your experimental code gave the framework -- I hate starting from scratch. ;)
The API is interesting. With Magpie's caching, though, I'm not sure that the API offers anything useful that we can't easily do with the RSS feed. For example the update checking available in the API is not necessary when you use Magpie. And although the API permits adding and deleting of posts, that's not really going to be much use as part of a sideitem, is it?
I guess the one thing I'd use the API for would be to display my del.icio.us inbox -- but that function is not even enabled right now.
On the other hand, rewriting the code to utilize the API instead of requiring Magpie would make it more portable and maybe even permit François? to include it in the distribution (although Magpie is open source, so he could bundle it in whole or in part, I suppose -- [url=http://e107.org]e107[/url] does that).
10 dan Jul 15, 2005 22:35
I've made additional modifications to the del.icio.us sidebar item.
My post is [url=http://www.yabfog.com/blog/yabfog/2005/05/17/del_icio_us_sidebar_item]here[/url], and the latest version of the code is [url=http://www.yabfog.com/files/delicious.phps]here[/url].
11 dan Aug 16, 2005 01:18
Walter, thanks for turning me on to MySQLicious. It's a much better solution for including your del.icio.us bookmarks as a b2evolution sidebar item.
I'm using the new code I wrote on my site. Check it out.
The [url=http://www.yabfog.com/files/mysqlicious.phps]code[/url] -- My [url=http://www.yabfog.com/blog/]site[/url] -- My [url=http://www.yabfog.com/blog/yabfog/2005/08/15/mysqlicious_based_del_icio_us_sidebar_it]post[/url] describing the set-up
I was just looking to see if anyone had done this.
Combine automatically blogging your del.icio.us feed with pulling down snapshots from alexa/snapshots. That would be beautiful. Perhaps it could only blog certain keywords, or ignore certain others. This would be an amazingly fast way to blog things, but could be extended to read other rss feeds I imagine?