[dokuwiki] Re: rss with details ?

  • From: Jan Galinski <jangal74@xxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 4 Nov 2005 09:47:49 +0100

> I think about sth. like {{rss>http://inhalt.serviert.de/feed.php 
> [description=on]}}

Thanks for the inspiration. I didnt do configuration via wiki-syntax
yet, but since they are using magpie, you get all the information you
need, you just have to display it.
Therefore, go to dokuwiki\inc\parser\xhtml.php

and have a look at the function rss.

I changed it to display Link, Title, date and description in a nicely
rendered definition list (only list that makes sense in this case in
my opinion).

if you uncomment the print_r, you get an output of all possible fields to use.

/**
     * Renders an RSS feed using Magpie
     *
     * @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
     */
    function rss ($url){
        global $lang;
        define('MAGPIE_CACHE_ON', false); //we do our own caching
        define('MAGPIE_DIR', DOKU_INC.'inc/magpie/');
        define('MAGPIE_OUTPUT_ENCODING','UTF-8'); //return all feeds as UTF-8
        require_once(MAGPIE_DIR.'/rss_fetch.inc');

        //disable warning while fetching
        $elvl = error_reporting(E_ERROR);
        $rss  = fetch_rss($url);
        error_reporting($elvl);

        $this->doc .= '<dl class="rss">';
        if($rss){
            foreach ($rss->items as $item ) {
                //print_r($item);
                $this->doc .= '<dt>';
                $this->externallink($item['link'],$item['title']);
                $this->doc .= '</dt>';
                $this->doc .= '<dd class="date">' .
date("d.m.Y",$item['date_timestamp']) . '</dd>'."\n";
                $this->doc .= '<dd>' . $item['description'] . '</dd>'."\n";

            }
        }else{
            $this->doc .= '<li>';
            $this->doc .= '<em>'.$lang['rssfailed'].'</em>';
            $this->externallink($url);
            $this->doc .= '</li>';
        }
        $this->doc .= '</dl>';
    }
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: