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 'stylesheets' 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 $stylesheets and the default script to
33 * member $javascripts. 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 * * 'stylesheets' => list of .css files without any path
41 * * 'javascripts' => 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['stylesheets']))
56 $this->stylesheets = $params['stylesheets'];
58 $this->stylesheets = array();
60 if (isset($params['javascripts']))
61 $this->javascripts = $params['javascripts'];
63 $this->javascripts = array();
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_stylesheet') != '')
72 $this->stylesheets[] = $CI->config->item('default_stylesheet');
73 if ($CI->config->item('default_javascript') != '')
74 $this->javascripts[] = $CI->config->item('default_javascript');
76 // URL correct prefixes
77 foreach ($this->stylesheets as $i => $val)
78 $this->stylesheets[$i] = site_url("stylesheets/$val");
79 foreach ($this->javascripts as $i => $val)
80 $this->javascripts[$i] = site_url("javascript/$val");
84 /* End of file HTML_head_params.php */
85 /* Location: ./application/libraries/HTML_head_params.php */