Example #1
0
 private function calculHookCommon($params)
 {
     $pref = self::getPreferences();
     $list = News::listNews();
     if ($list) {
         $i = 0;
         foreach ($list as $val) {
             $list[$i]['link'] = News::linkPost($val['id_news'], $val['link_rewrite'], $val['id_lang']);
             $i++;
         }
     }
     $this->smarty->assign(array('last_post_list' => $list, 'blog_conf' => $pref, 'linkPosts' => News::linkList(), 'img_path' => _THEME_NEWS_DIR_));
     return true;
 }
Example #2
0
 public function displayList()
 {
     $id_lang = $this->context->language->id;
     $id_shop = $this->context->shop->id;
     $limit_per_page = intval($this->conf['list_news_limit_page']);
     $current_page = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 1;
     $start = ($current_page - 1) * $limit_per_page;
     $list = News::listNews($start, $limit_per_page, true, 'n.position');
     $nb_articles = News::totalNews();
     // first page if page not exists
     $max_page = ceil($nb_articles / $limit_per_page);
     $next = $current_page > 1 ? true : false;
     //articles plus recents
     $back = $current_page >= 1 && $current_page < $nb_pages ? true : false;
     //articles precedents
     $this->context->smarty->assign(array('news_list' => $list, 'next' => $next, 'back' => $back, 'curr_page' => $current_page));
     $this->setTemplate('list.tpl');
 }
Example #3
0
<?php

require_once "../../helper.php";
require_once "../../classes/News.class.php";
$helper = new Helper();
$newsObj = new News();
$result = $newsObj->listNews($_POST);
echo json_encode($result);