Exemplo n.º 1
0
 public function porfolio_list($lang = 'fr', $category = false)
 {
     $this->load->helper(array('html', 'view'));
     $this->load->model('tags_model');
     $filename = $this->smartcache->CacheName('porfolio_list', array('lang' => $lang, 'ajax' => $this->data->ajax, 'category' => $category));
     $cache = $this->smartcache->get_data($filename);
     if ($cache && ENVIRONMENT != 'development') {
         $this->output->set_output($cache);
     } else {
         $this->load->helper('portfolio/portfolio');
         $data = array();
         //gestion des catégories
         //calcul de l'id
         if ($category) {
             $category_id = explode('-', $category);
             $category_id = $category_id[0];
             $category_data = $this->portfolio_model->CategoryDetails($category_id, true);
             // redirection si le nom de la news n'est pas bon
             if ($category != $category_id . '-' . url_title($category_data['name'], '-')) {
                 redirect(site_url(array('portfolio', 'c' . $category_id . '-' . url_title($category_data['name'], '-'))), 'location', 301);
             }
         }
         $data['list'] = portfolio_thumb_list($category ? $category : false);
         $data['bodyclass'] = 'portfolio';
         $data['lang'] = $lang;
         $data['title'] = 'Portfolio' . ($category ? '<br/><small>' . $category_data['name'] . '</small>' : '');
         $data['category_id'] = $category ? $category_id : false;
         $page_title = $this->config->item('site_name') . ' | ' . ($category ? $category_data['meta_title'] != '' ? $category_data['meta_title'] : $category_data['name'] : 'Portfolio');
         //chargement de la page
         if ($this->data->ajax) {
             $meta = array('bodyclass' => $data['bodyclass'], 'title' => $page_title);
             $this->load->view('portfolio/item/list', $data);
             $this->load->view('templates/ajax_callback', $meta);
         } else {
             //chargement de du template
             $layout['page'] = $this->load->view('portfolio/item/list', $data, true);
             // traitement des metas
             $meta_data = array();
             $meta_data['lang'] = $lang;
             if ($category) {
                 $meta_data['meta_keywords'] = $this->tags_model->get_meta_by_parent($category_id, 'portfolio_categories_' . $this->lang->lang(), 'meta_keyword');
                 $meta_data['meta_title'] = $page_title;
                 $meta_data['meta_description'] = $category_data['meta_description'];
             } else {
                 $meta_data['meta_keywords'] = array();
                 //$this->tags_model->get_meta_by_parent($id, 'portfolio_item', 'meta_keyword');
                 $meta_data['meta_title'] = $page_title;
                 $meta_data['meta_description'] = '';
             }
             require_once APPPATH . 'viewModels/global/HeaderViewModel.php';
             $header_viewmodel['header_viewmodel'] = new HeaderViewModel($meta_data, 'portfolio');
             $this->load->view('templates/meta_head', $header_viewmodel);
             $this->load->view('templates/layout', $layout);
             $this->load->view('templates/meta_foot');
         }
         $this->smartcache->save_output($filename);
     }
 }
Exemplo n.º 2
0
 private function helpers_visitor($string, $i)
 {
     $result = FALSE;
     $params = $this->function_match_tree[6][$i];
     switch ($this->function_match_tree[4][$i]) {
         case 'print_form':
             $this->CI->load->helper('/contact/contact');
             $result = print_form($params);
             break;
         case 'print_contact_info_list':
             $this->CI->load->helper('/contact/contact');
             $result = print_contact_info_list($params);
             break;
         case 'banner_zone':
             $this->CI->load->helper('/banners/banners');
             $result = banner_zone($params);
             break;
         case 'portfolio_categories_list':
             $this->CI->load->helper('/portfolio/portfolio');
             $result = portfolio_categories_list();
             break;
         case 'portfolio_thumb_list':
             $this->CI->load->helper('/portfolio/portfolio');
             $result = portfolio_thumb_list($params);
             break;
         case 'last_news_item':
             $this->CI->load->helper('/news/news');
             $result = last_news_item($params);
             break;
         case 'news_list':
             $this->CI->load->helper('/news/news');
             $params = explode(',', $params);
             $result = news_list($params[0], intval($params[1]));
             break;
         case 'menu':
             $this->CI->load->helper('/pages/menus');
             $result = print_menu($params);
             break;
         case 'sub_menu':
             $this->CI->load->helper('/pages/menus');
             $params = explode(',', $params);
             $result = print_menu($params[0], intval($params[1]));
             break;
     }
     if ($result) {
         $string = str_replace($this->function_match_tree[0][$i], $result, $string);
     }
     return $string;
 }