<?php
/***************************************************************
Paramètres de configuration du script
/**************************************************************/

$flux             =        'http://feeds.feedburner.com/Jarodxxx?format=xml'; // adresse du flux à afficher
$nb_items        =        5; // nombre d'éléments à afficher
$size_texte        =         60; //nombre de caractères à afficher

/***************************************************************/



function TruncText ($text , $size, $charset='utf-8'){
    $text = strip_tags ( html_entity_decode( $text , ENT_COMPAT, $charset ) );
    if ( strlen( $text) + 4 > $size ) {
        $text  = substr ( $text , 0 , $size).' ...' ;
    }   
    return $text;
}


$xml = simplexml_load_file($flux);

echo '<ul">'."\n";
$i = 0;
foreach ( $xml->channel->item as $value){
    if ( $i < $nb_items ){
        echo '<li>
        <a href="'.$value->link.'">'.utf8_decode($value->title).'</a>
            <span>'.utf8_decode(TruncText($value->description, $size_texte )).'</span>
        </li>'."\n";
        echo '<br />'."\n";
    }
$i++;
}
echo '</ul>'."\n";
?>