No tags defined at mod_delicious
Posted: Mon Mar 17, 2008 1:19 pm
Hi,
I'm new to Joomla (development) but are still try to make a working module for showing Delicious tags & links.
Main purpose for the module: show tagcloud (as in Del.icio.us) with SEO-readable tags. Click on tag (by onClick() or <a href> ) results in a list of links (with description) belonging to that tag.
I'm altering the Delicious module (mod_delicious) which uses the code below. The code reeds the RSS feed and stores all values into a PHP-array which can be used to show. The problem is that the code does not show the tags belonging to the link.
$feed =& JFactory::getXMLparser('RSS', array('rssUrl' => 'http://del.icio.us/rss/' . $username . '/'));
$items = $feed->get_items(0, $posts); //get items
$count = sizeof($items); // count
if($count < 1){
return $rows;
}
for($i = 0; $i < $count; $i++){ // iteration
$item =& $items[$i]; // set item
$rows[$i] = new stdClass(); // create row
$rows[$i]->link = htmlspecialchars($item->get_link()); // link
$rows[$i]->title = html_entity_decode($item->get_title()); // title
if($tags_show){ // tags
list($tags) = $item->get_categories();
$rows[$i]->tags = $tags_before . modDeliciousHelper::linkifyTags($tags, $username, $tags_max, $tags_glue) . $tags_after;
} else {
$rows[$i]->tags = '';
}
if($tags_show){ // description
$rows[$i]->desc = $desc_before . $item->get_description() . $desc_after;
} else {
$rows[$i]->desc = '';
}
}
return $rows;
}
/**
* Create links from the tags
function linkifyTags($tags, $username, $limit, $glue) {
if($limit < 1){ return ''; }
$tmp = array();
$array = explode(" ", $tags, $limit);
for ($i = 0 ; $i < $limit && $i < sizeof($array) ; $i++) {
$tmp[] = "<a href='http://del.icio.us/$username/$array[$i]' title='$array[$i] tag'>$array[$i]</a>";
}
return implode($glue, $tmp);
}
The problem is that it doesn't show the tags ($rows[$i]->tags). When I ran the module it shows "Object" at the tags.
To solve this problem I've tried the following:
$rows[$i]->tags = $item->get_categories(); //
or
$rows[$i]->tags = list($item->get_categories());
or
$rows[$i]->tags = implode(list($item->get_categories()));
or
$rows[$i]->tags = explode(list($item->get_categories()));
Nothing seems to help. The questions I have are:
- What does the function get_categories() do? I know that it is a standard function declared in Simplepie.php, but what is the output?
- Is there another Simplepie-function I can use?
- What is the difference between get_category() and get_categories() ?
- Is there a (another) way to see the XML output of the RSS-feed?
Thanks,
Robin
I'm new to Joomla (development) but are still try to make a working module for showing Delicious tags & links.
Main purpose for the module: show tagcloud (as in Del.icio.us) with SEO-readable tags. Click on tag (by onClick() or <a href> ) results in a list of links (with description) belonging to that tag.
I'm altering the Delicious module (mod_delicious) which uses the code below. The code reeds the RSS feed and stores all values into a PHP-array which can be used to show. The problem is that the code does not show the tags belonging to the link.
$feed =& JFactory::getXMLparser('RSS', array('rssUrl' => 'http://del.icio.us/rss/' . $username . '/'));
$items = $feed->get_items(0, $posts); //get items
$count = sizeof($items); // count
if($count < 1){
return $rows;
}
for($i = 0; $i < $count; $i++){ // iteration
$item =& $items[$i]; // set item
$rows[$i] = new stdClass(); // create row
$rows[$i]->link = htmlspecialchars($item->get_link()); // link
$rows[$i]->title = html_entity_decode($item->get_title()); // title
if($tags_show){ // tags
list($tags) = $item->get_categories();
$rows[$i]->tags = $tags_before . modDeliciousHelper::linkifyTags($tags, $username, $tags_max, $tags_glue) . $tags_after;
} else {
$rows[$i]->tags = '';
}
if($tags_show){ // description
$rows[$i]->desc = $desc_before . $item->get_description() . $desc_after;
} else {
$rows[$i]->desc = '';
}
}
return $rows;
}
/**
* Create links from the tags
function linkifyTags($tags, $username, $limit, $glue) {
if($limit < 1){ return ''; }
$tmp = array();
$array = explode(" ", $tags, $limit);
for ($i = 0 ; $i < $limit && $i < sizeof($array) ; $i++) {
$tmp[] = "<a href='http://del.icio.us/$username/$array[$i]' title='$array[$i] tag'>$array[$i]</a>";
}
return implode($glue, $tmp);
}
The problem is that it doesn't show the tags ($rows[$i]->tags). When I ran the module it shows "Object" at the tags.
To solve this problem I've tried the following:
$rows[$i]->tags = $item->get_categories(); //
or
$rows[$i]->tags = list($item->get_categories());
or
$rows[$i]->tags = implode(list($item->get_categories()));
or
$rows[$i]->tags = explode(list($item->get_categories()));
Nothing seems to help. The questions I have are:
- What does the function get_categories() do? I know that it is a standard function declared in Simplepie.php, but what is the output?
- Is there another Simplepie-function I can use?
- What is the difference between get_category() and get_categories() ?
- Is there a (another) way to see the XML output of the RSS-feed?
Thanks,
Robin