Example #1
0
 <?php 
$oArticles = new Articles();
if (!isset($id)) {
    // Reading categories and combo display for selecting categories
    $alistCat = $oArticles->getCategoryData();
    include 'core/blog/views/form-categories.php';
}
if (isset($cat)) {
    // If a category is specified then display the articles in this category
    $oArticles->ReadAllArticles('util', $cat);
    $aConfigValues = $oArticles->getConfigValues();
    include 'core/blog/views/display_all_articles.php';
    // Pagination
    $nbTotArt = $aConfigValues['total_nbr_display'];
    $nbrPerPage = $aConfigValues['art_page'];
    $oPagination->DisplayPagination($nbTotArt, $nbrPerPage, 'blog.php', "cat={$cat}");
} elseif ((!isset($cat) or $cat == 'Tous') and !isset($id)) {
    // If no selected category or 'All' is selected then display all articles (all categories)
    $aArticles = $oArticles->ReadAllArticles('util', 0);
    $aConfigValues = $oArticles->getConfigValues();
    include 'core/blog/views/display_all_articles.php';
    // Result Pagination
    $nbTotArt = $aConfigValues['total_nbr_display'];
    $nbrPerPage = $aConfigValues['art_page'];
    $oPagination->DisplayPagination($nbTotArt, $nbrPerPage, 'blog.php', '');
} elseif (isset($id)) {
    // Recording a comment or response (if entry form)
    $aMsg = $oAdmin->getItemTransation('BLOG', 'FRONT', $lang, 'MSG_COMMENTS_PUBLISH');
    if (isset($new)) {
        // Registration new comment.
        $oArticles->RecordNewComm($nom, $mail, $siteweb, $contenu, $id, 'new', $aMsg, $host);