Esempio n. 1
0
 public function hookLeftColumn($params)
 {
     if (Module::isInstalled('smartblog') != 1) {
         $this->smarty->assign(array('smartmodname' => $this->name));
         return $this->display(__FILE__, 'views/templates/front/install_required.tpl');
     } else {
         if (!$this->isCached('smartblogpopularposts.tpl', $this->getCacheId())) {
             global $smarty;
             $id_lang = $this->context->language->id;
             $posts = SmartBlogPost::getPopularPosts($id_lang);
             $i = 0;
             foreach ($posts as $post) {
                 if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/' . $post['id_smart_blog_post'] . '.jpg')) {
                     $image = $post['id_smart_blog_post'];
                     $posts[$i]['post_img'] = $image;
                 } else {
                     $posts[$i]['post_img'] = 'no';
                 }
                 $i++;
             }
             $smarty->assign(array('posts' => $posts));
         }
         return $this->display(__FILE__, 'views/templates/front/smartblogpopularposts.tpl', $this->getCacheId());
     }
 }