1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
3 * Library Article_Controller can be extended by a controller to be used for
4 * content pages that depend on the language.
6 * Several language specific parameters can be coded in language files.
7 * Non language specific parameters can be putted in config files.
10 * @author Călin-Andrei Burloiu
12 class Article_Controller extends CI_Controller {
14 function __construct()
16 parent::__construct();
20 * Override this with site specific information (header, menus...) and call
21 * $this->_load which is a generic method that loads the article.
22 * Both parameters must be passed to $this->_load.
24 public function _remap($method, $params = array())
26 $this->load->view('echo',
27 array('output' => $this->_load($method, $params),
33 * Returns the article based on the language from
34 * "application/views/article/$language/$method".
36 * @param string $method defines article name
37 * @param array $params odd elements are keys and even elements are
38 * their values (eg.: [0] => key, [1] => value etc.). This are going to
39 * be converted to an associative array that is passed to the view if
40 * $assoc parameter is FALSE. Otherwise this parameter is already an
42 * @param bool $assoc states whether or not $params is associative
44 public function _load($method, $params = array(), $assoc = FALSE)
49 $params_assoc = array();
51 foreach ($params as $i => $val)
56 $params_assoc[$prev_val] = $val;
58 $alt = ($alt + 1) % 2;
62 $params_assoc = $params;
64 return $this->load->view('article/'. $this->config->item('language')
65 . '/' . $method, $params_assoc, TRUE);
69 /* End of file Article_Controller.php */
70 /* Location: ./application/core/Article_Controller.php */