Subversion Repositories Applications.papyrus

Rev

Rev 2146 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?
function truncate($text, $chars = 25) {
    $text = $text." ";
    $text = substr($text,0,$chars);
    $text = substr($text,0,strrpos($text,' '));
    $text = $text."...";
        // suppression des sauts de ligne et des tags
        // le rendu désiré ne doit contenir que du texte simple
        $text = str_replace(array("\r\n", "\r"), "", strip_tags($text));
    return $text;
}
?>

<style>
.image_rss_simple {
        float: right;
}

.image_rss_simple > img {
        padding-left: 7px;
    padding-top: 6px;
    max-width: 90px;
}

.description_rss_simple h3 {
        font-size: 12px;
        margin: 0;
}

.corps_description_rss_simple {
        text-align: justify;
        -webkit-hyphens: auto;
        -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}
</style>

<!-- SYNDICATION - DEBUT -->
        <div class="flux_RSS">
                <?php if ($erreurs || $informations) : ?>
                        <h1>Erreur</h1>
                        <div class="contenu_RSS">
                                <b>Impossible d'afficher le flux.</b><br />
                                
                                <!-- Affichage des erreurs et messages d'information : -->
                                <?php if ($erreurs) : ?>
                                        <?php foreach ($erreurs as $erreur) : ?>
                                                <p class="pap_erreur"><?=$erreur;?></p>
                                        <?php endforeach; ?>
                                <?php endif; ?>
                                
                                <?php if ($informations) : ?>
                                        <?php foreach ($informations as $information) : ?>
                                                <p class="pap_info"><?=$information;?></p>
                                        <?php endforeach; ?>
                                <?php endif; ?>
                        </div>
                <?php else : ?>
                        <ul class="liste_rss_simple">
                                <?php foreach ($sites as $site) : ?>
                                        <?php foreach ($site['pages'] as $page) : ?>
                                <li>
                                        <div class="image_rss_simple">
                                                <?php $page['image'] = str_replace('align="left"', '', $page['image']); ?>
                                                <?= $page['image']; ?>
                                        </div>
                                        <div class="description_rss_simple">
                                                <h3>
                                                        <? $titre_page = preg_replace('/^\d+-\d+&nbsp;:/', '', $page['titre']); ?>
                                                        <a href="<?=$page['url']?>"><?=$titre_page?></a>
                                                </h3>
                                                        <div class="corps_description_rss_simple" >
                                                                <?php $page['description'] = preg_replace("/<img[^>]+\>/i", "", $page['description']); ?>
                                                        <?= truncate($page['description'], 275); ?>
                                                        <br />
                                                        <a href="<?=$page['url']?>">En savoir plus.</a><br />
                                                </div>
                                        </div>
                                        <hr class="nettoyage" />
                                        </li>
                                        <?php endforeach; ?>
                                <?php endforeach; ?>
                        </ul>
                <?php endif; ?>
        </div>
<!-- SYNDICATION - FIN -->