Ejemplo n.º 1
0
 public function smartblogrelatedpostsHookdisplaySmartAfterPost($params)
 {
     if (Tools::getvalue('controller') == 'category' || Tools::getvalue('controller') == 'tagpost') {
         return;
     }
     $id_post = pSQL(Tools::getvalue('id_post'));
     if ($id_post == '') {
         $slug = Tools::getvalue('slug');
         $id_post = $this->slug2id($slug);
     }
     if (!$this->isCached('plugins/smartblogrelatedposts.tpl', $this->getCacheId())) {
         $posts = SmartBlogPost::getRelatedPostsById_post($id_post);
         $i = 0;
         foreach ($posts as $i => &$post) {
             $posts[$i]['created'] = Smartblog::displayDate($post['created']);
             $employee = new Employee((int) $post['id_author']);
             $post['lastname'] = $employee->lastname;
             $post['firstname'] = $employee->firstname;
         }
         $this->smarty->assign(array('posts' => $posts));
     }
     return $this->display(__FILE__, 'views/templates/front/plugins/smartblogrelatedposts.tpl');
 }