//S'il y a quelque chose
if (pg_num_rows($result1) != 0) {
    if ($nombre_article_csf_home == 1) {
        echo '<span class="dernier-article">Le dernier article</span>';
    } else {
        echo '<span class="dernier-article">Les ' . $nombre_article_csf_home . ' derniers articles</span>';
    }
    while ($affiche = pg_fetch_array($result1)) {
        //on va chercher le nom du dossier pour chaque article
        $dossier_article = pg_query("SELECT categorie_name, categorie_slug FROM csf_categories WHERE categorie_id = '" . pg_escape_string($affiche['post_categorie']) . "'");
        while ($nom_dossier = pg_fetch_array($dossier_article)) {
            $titre_categorie = $nom_dossier['categorie_name'];
            $nom_du_dossier = $nom_dossier['categorie_slug'];
        }
        //------fin nom de dossier---------------
        echo '<div class="cadre"><h2 class="h2"><a title="' . $affiche['post_title'] . '" href="http://' . $_SERVER['HTTP_HOST'] . '/' . $nom_du_dossier . '/' . sansPointPhp($affiche['post_slug']) . '">' . $affiche['post_title'] . '</a></h2>     <p>' . tronquer(nl2br($affiche['post_description'])) . '<br/><br/><span class="date">' . convertDate($affiche['post_date']) . ' � <strong><a title="' . $titre_categorie . '" href="http://' . $_SERVER['HTTP_HOST'] . '/' . $nom_du_dossier . '/">' . $titre_categorie . '</a></strong></span></p></div>';
    }
}
?>
   
    <!-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -->
  
    <!-- JavaScript -->
    <script src="js/jquery-1.10.2.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/modern-business.js"></script>

</body>

</html>
?>

</h1>

<p class="fil-ariane">
	<strong>
		<a title="<?php 
echo $titre_categorie;
?>
" href="http://<?php 
echo $_SERVER['HTTP_HOST'];
?>
"></a>
	</strong>
</p>

<?php 
$page = pg_query("SELECT post_title, post_description, post_slug, post_date FROM csf_posts WHERE post_categorie = " . $id_categorie . " AND post_approved = '1' ORDER BY post_id DESC");
while ($affiche = pg_fetch_array($page)) {
    echo '<div><h2 class="h2"><a title="' . $affiche['post_title'] . '" href="http://' . $_SERVER['HTTP_HOST'] . '/' . $catSlug . '/' . $subCatSlug . '/' . sansPointPhp($affiche['post_slug']) . '">' . $affiche['post_title'] . '</a></h2><p>' . tronquer(nl2br($affiche['post_description'])) . '<br/><br/><span>' . convertDate($affiche['post_date']) . '</span></p></div>';
}
?>

</div>
<?php 
//include('footer.php');
?>
</div>
 
</body>
</html>
示例#3
0
<?php 
include 'config.php';
// On indique que c'est du xml
header("Content-type: application/xml");
include 'fonctions.php';
//On se connecte à la base de données
include 'db_connect.php';
db_open();
//On sélectionne les données de la Home Page
$index = pg_query("SELECT home_title, home_description FROM csf_home");
while ($csf_home = pg_fetch_array($index)) {
    $titre = $csf_home['home_title'];
    $description = $csf_home['home_description'];
}
//Entête du flux rss
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n <rss version=\"2.0\">\n <channel>\n <title>{$titre}</title>\n <link>{$url}</link>\n <description>{$description}</description>\n <language>fr</language>\n\n";
//On sélectionne les données des pages
$result = pg_query("SELECT post_title, post_description, post_slug, post_date, post_categorie FROM csf_posts WHERE post_approved = '1' ORDER BY post_id ASC LIMIT 20");
while ($affiche = pg_fetch_array($result)) {
    //On sélectionne les catégories qui correspondent aux pages
    $result1 = pg_query("SELECT categorie_slug FROM csf_categories WHERE categorie_id = " . $affiche['post_categorie'] . "");
    while ($affiche1 = pg_fetch_array($result1)) {
        //On affiche les flux
        echo '<item> <title>' . $affiche['titre'] . '</title> <link>' . $url . '/' . $affiche1['categorie_slug'] . '/' . sansPointPhp($affiche['post_slug']) . '</link> <description><![CDATA[' . tronquer(nl2br($affiche['post_description'])) . ']]></description> <pubDate>' . date("D, d M Y H:i:s +0000", $affiche['post_date']) . '</pubDate> </item>';
    }
}
// Fermeture de la connexion à la base de données
db_close();
//On ferme le flux rss
echo "</channel>\n</rss>";