function afficher() { $articles = new AFUP_Site_Articles($this->bdd); $derniers_articles = $articles->chargerArticlesDeRubrique($this->id); $articles = array(); foreach ($derniers_articles as $article) { $descriptif = $article->descriptif ? $article->descriptif : $article->chapeau; $articles[] = '<h2><a href="' . $article->route("pages/lille/") . '">' . $article->titre . '</a></h2> <p>' . $descriptif . '</p><p class="rubrique-article-date">' . date('d/m/Y', $article->date) . '</p>'; } return '<h1>' . $this->nom . '</h1> <ul class="rubrique-articles"><li>' . join($articles, '</li><li>') . '</li></ul>'; }
<?php require_once '../../include/prepend.inc.php'; require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Site.php'; require_once dirname(__FILE__) . '/_config.inc.php'; setlocale(LC_TIME, 'fr_FR.utf8', 'fra'); $smarty->caching = false; $aujourdhui = time(); $date_forum = $config_forum['date_fin']; $jours_avant_forum = $date_forum - $aujourdhui; if ($jours_avant_forum < 0) { $alerte_avant_forum = "<fieldset>"; $alerte_avant_forum .= "<legend> Inscriptions fermées ! </legend>"; $alerte_avant_forum .= "<h3>Les inscriptions sont désormais fermées.<br /> Rendez-vous l'année prochaine.</h3>"; $alerte_avant_forum .= "</fieldset>"; } else { $alerte_avant_forum = ""; } $smarty->assign('alerte_avant_forum', $alerte_avant_forum); $articles = new AFUP_Site_Articles($bdd); $actualites = $articles->chargerArticlesDeRubrique(72); // 72 = rubrique Forum PHP 2012 $smarty->assign('actualites', $actualites); $smarty->display('index.html');
<?php $action = verifierAction(array('lister', 'ajouter', 'modifier', 'supprimer')); $tris_valides = array('titre', 'date'); $sens_valides = array('asc', 'desc'); $smarty->assign('action', $action); require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Site.php'; require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Personnes_Physiques.php'; $articles = new AFUP_Site_Articles($bdd); $personnes_physiques = new AFUP_Personnes_Physiques($bdd); if ($action == 'lister') { $list_champs = '*'; $list_ordre = 'date'; $list_sens = 'desc'; $list_filtre = false; if (isset($_GET['sens']) && in_array($_GET['sens'], array_keys($sens_valides))) { $list_sens = $_GET['sens']; } else { $_GET['sens'] = $list_sens; } if (isset($_GET['tri']) && in_array($_GET['tri'], array_keys($tris_valides))) { $list_ordre = $_GET['tri']; } else { $_GET['tri'] = $list_ordre; } if (isset($_GET['filtre'])) { $list_filtre = $_GET['filtre']; } else { $_GET['filtre'] = $list_filtre; } // Mise en place de la liste dans le scope de smarty
<?php /** * Fichier Feed RSS site 'AFUP' * * @author Perrick Penet <*****@*****.**> * @author Olivier Hoareau <*****@*****.**> * @copyright 2010 Association Française des Utilisateurs de PHP * * @category AFUP * @package AFUP * @group Pages */ require_once dirname(__FILE__) . '/../../../sources/Afup/Bootstrap/Http.php'; require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Site.php'; $articles = new AFUP_Site_Articles($bdd); $derniersArticles = array(); foreach ($articles->chargerDerniersAjouts(20) as $article) { $derniersArticles[] = array('titre' => $article->titre, 'contenu' => $article->contenu, 'url' => $article->route, 'maj' => date(DATE_RSS, $article->date)); } $feed = array('title' => "Le flux RSS de l'AFUP", 'url' => 'http://afup.org/', 'link' => 'http://afup.org/rss.php', 'email' => '*****@*****.**', 'author' => 'Nicolas Silberman / AFUP', 'date' => date(DATE_RSS), 'lastBuildDate' => isset($derniersArticles[0]['maj']) ? $derniersArticles[0]['maj'] : date('Y-m-d H:i:s', time())); $smarty->assign('billets', $derniersArticles); $smarty->assign('feed', $feed); header('Content-Type: text/xml; charset=UTF-8'); $smarty->display('rss.xml');
function autres_articles() { $articles = new AFUP_Site_Articles($this->bdd); return $articles->chargerArticlesDeRubrique($this->id_site_rubrique); }
<?php require_once dirname(__FILE__) . '/../../../sources/Afup/Bootstrap/Http.php'; require_once dirname(__FILE__) . '/../../../sources/Afup/AFUP_Site.php'; $articles = new AFUP_Site_Articles($bdd); $derniersArticles = array(); foreach ($articles->chargerArticlesDeRubrique(73, 20) as $article) { $derniersArticles[] = array('titre' => $article->titre, 'contenu' => $article->contenu, 'url' => $article->route, 'maj' => date(DATE_RSS, $article->date)); } $feed = array('title' => "Le flux RSS de l'AFUP", 'url' => 'http://afup.org/', 'link' => 'http://afup.org/rss.php', 'email' => '*****@*****.**', 'author' => 'Nicolas Silberman / AFUP', 'date' => date(DATE_RSS), 'lastBuildDate' => isset($derniersArticles[0]['maj']) ? $derniersArticles[0]['maj'] : date('Y-m-d H:i:s', time())); $smarty->assign('billets', $derniersArticles); $smarty->assign('feed', $feed); header('Content-Type: text/xml; charset=UTF-8'); $smarty->display('rss.xml');