Subversion Repositories Applications.papyrus

Rev

Rev 772 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 772 Rev 843
Line 4... Line 4...
4
define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');
4
define('MAGPIE_CACHE_DIR', '/tmp/magpie_cache');
5
define('OUVRIR_LIEN_RSS_NOUVELLE_FENETRE', 1);
5
define('OUVRIR_LIEN_RSS_NOUVELLE_FENETRE', 1);
6
define('FORMAT_DATE', 'jma');
6
define('FORMAT_DATE', 'jma');
7
require_once(MAGPIE_DIR.'rss_fetch.inc');
7
require_once(MAGPIE_DIR.'rss_fetch.inc');
Line 8... Line 8...
8
 
8
 
9
function voir_rss($titre='', $url='', $nb=0, $nouvelle_fenetre=OUVRIR_LIEN_RSS_NOUVELLE_FENETRE, $formatdate=FORMAT_DATE) {
9
function voir_rss($titre='', $url='', $nb=0, $nouvelle_fenetre=OUVRIR_LIEN_RSS_NOUVELLE_FENETRE, $formatdate=FORMAT_DATE, $template = "") {
10
	$res= '';
10
	$res= '';
11
	if ( $url!='' ) {
11
	if ( $url!='' ) {
-
 
12
		$rss = fetch_rss( $url );
-
 
13
		if ($template != "") {
-
 
14
			$res = ""; $i = 0 ;
-
 
15
			foreach ($rss->items as $item) {
-
 
16
				if (strlen($item['description']) > 200) {
-
 
17
					$item['description'] = substr ($item['description'] , 0, 300).'... <a href="'.$item['link'].'">Lire la suite</a>';
-
 
18
				}
-
 
19
				$res .= str_replace ('{num}', ++$i, 
-
 
20
						str_replace ('{item}', '<a href="'.$item['link'].'" target="_top">'.$item['title'].'</a>', 
-
 
21
						str_replace ('{description}', $item['description'], $template))) ;
-
 
22
				$res .= "\n";
-
 
23
				if ($i >= $nb) break;
-
 
24
			}
-
 
25
			return $res ;
12
		$rss = fetch_rss( $url );
26
		}
13
		if ( $titre=='' ) {$res .= '<h2>'.$rss->channel['title'].'</h2>'."\n";}
27
		if ( $titre=='' ) {$res .= '<h2>'.$rss->channel['title'].'</h2>'."\n";}
14
		elseif ( $titre!='0' ) {$res .= '<h2>'.$titre.'</h2>'."\n";}
28
		elseif ( $titre!='0' ) {$res .= '<h2>'.$titre.'</h2>'."\n";}
15
		$res .= '<ul class="liste_rss">'."\n";
29
		$res .= '<ul class="liste_rss">'."\n";
16
		$i=0;
30
		$i=0;