1 <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
4 * Library HTML_head_params contains HTML information that is going to be
5 * included inside the head tag like: title, stylesheets, scripts and meta
8 * The constructor automatically adds the default stylesheet and default script
9 * if any from 'application/config/p2p-tube.php' so they don't have to be added
12 * The variables are passed as data in 'application/views/html_begin.php' which
13 * is going to generate the tags based on their information.
15 * All .css files must be located in 'css' and all .js file in
19 * @author Călin-Andrei Burloiu
21 class Html_head_params {
27 // Dictionary for meta tags: name => content
31 * Initializes member variables with the parameters provided and adds the
32 * default stylesheet to member $css and the default script to
33 * member $js. The URL prefixes are also added to filenames.
35 * Do not add in the parameters list the default stylesheet and script!
38 * @param array $params asscociative list with the following parameters:
39 * * 'title' => HTML title tag content (page title)
40 * * 'css' => list of .css files without any path
41 * * 'js' => list of .js files without any path
42 * * 'metas' => associative list of "name => content" meta
44 public function __construct($params)
46 $CI =& get_instance();
47 $CI->load->helper('url');
48 $CI->load->config('p2p-tube');
50 if (isset($params['title']))
51 $this->title = $params['title'];
55 if (isset($params['css']))
56 $this->css = $params['css'];
60 if (isset($params['js']))
61 $this->js = $params['js'];
65 if (isset($params['metas']))
66 $this->metas = $params['metas'];
68 $this->metas = array();
70 // Default parameters from configuration file
71 if ($CI->config->item('default_css') != '')
72 $this->css[] = $CI->config->item('default_css');
73 if ($CI->config->item('default_js') != '')
74 $this->js[] = $CI->config->item('default_js');
76 // URL correct prefixes
77 foreach ($this->css as $i => $val)
78 $this->css[$i] = site_url("css/$val");
79 foreach ($this->js as $i => $val)
80 $this->js[$i] = site_url("js/$val");
84 /* End of file HTML_head_params.php */
85 /* Location: ./application/libraries/HTML_head_params.php */