Allow for rss feeds to use description data instead of title data for items (a la Yahoo Weather)
- Status
- Closed
- Subject
- Allow for rss feeds to use description data instead of title data for items (a la Yahoo Weather)
- Version
- 1.9.x
- Category
- Feature request
- Feature
- RSS
XML RPC
Templates (Smarty)
Modules - Resolution status
- Fixed or Solved
- Submitted by
- kingpin2k
- Rating
- Description
- Yahoo Weather (and, I assume other feeds) rss feed dumps neat html into the description field of the first item rather than the title. I've modified function.rss.php to accomodate this and allow users to continue to use the regular module creation interface. Basically, I added a new parameter "desc" such that if you use the resulting output will use the description field instead of the title field. Skipped items will still be skipped.Commit by lphuberdeau :: r42605 /trunk/templates/tiki-editpage.tpl: (link) [FIX] Wiki and plugin help works without this, avoid double inclusion, reduce memory footprint
Sorry, but I'm very new to Tikiwiki and may not conform to regular documentation standards...please correct me as neceesary. - Solution
<?php
//this script may only be included - so its better to die if called directly.
if $_SERVER%22SCRIPT_NAME%22,basename(FILE !== false) {
header("location: index.php");
exit;
}/* inserts the content of an rss feed into a module */
function smarty_function_rss($params, &$smarty)
{
global $tikilib;
global $dbTiki;
global $rsslib;
include_once('lib/rss/rsslib.php');
extract($params);
// Param = zone
if$id {
$smarty->trigger_error("assign: missing id parameter");
return;
}
if$max {
$max = 99;
}
if$desc {
$desc = 0;
}
// skip="x,y" will not print Xth and Yth items
// useful to avoid default first items
if (!empty($skip) && preg_match('/^\d+(,\d+)*$/', $skip)) {
$skipped_items = explode(',', $skip);
$skip = array();
foreach ($skipped_items as $i) {
$skip$i = 1;
}
} else {
$skip = array();
}
$data = $rsslib->get_rss_module_content($id);
$items = $rsslib->parse_rss_data($data, $id);if ($items0%22isTitle%22=="y") {
print('<ul class="rsslist">');
print '<a target="_blank" href="'.$items0%22link%22.'" class="linkmenu">'.$items0%22title%22.'</a>';
$items = array_slice ($items, 1);
}for($i=0;$i<count($items) && $i<$max;$i++) {
if ($items$i%22description%22 <> '') print('<li class="rssitem"><a target="_blank" href="'.$items$i%22link%22.'" class="rsslink">'.$items$i%22description%22.'</a>');
if (!$skip$i+1) {
if($desc) {if ($items$i%22pubDate%22 <> '') print(' <span class="rssdate">('.$items$i%22pubDate%22.')</span>');
print('</li>');}
if ($items$i%22title%22 <> '') print('<li class="rssitem"><a target="_blank" href="'.$items$i%22link%22.'" class="rsslink">'.$items$i%22title%22.'</a>');
else {if ($items$i%22pubDate%22 <> '') print(' <span class="rssdate">('.$items$i%22pubDate%22.')</span>');
print('</li>');}
print('</ul>');
}
}}
/* vim: set expandtab: */
?>
- Importance
- 3
- Priority
- 15
- Demonstrate Bug on Tiki 19+
-
This bug has been demonstrated on show2.tiki.org
Please demonstrate your bug on show2.tiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show2.tiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Demonstrate Bug (older Tiki versions)
-
This bug has been demonstrated on show.tikiwiki.org
Please demonstrate your bug on show.tikiwiki.org
Show.tiki.org is not configured properlyThe public/private keys configured to connect to show.tikiwiki.org were not accepted. Please make sure you are using RSA keys. Thanks.
- Ticket ID
- 721
- Created
- Wednesday 17 May, 2006 15:34:37 UTC
by Unknown - LastModif
- Sunday 18 June, 2017 23:01:14 UTC