X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=application%2Flibraries%2FHtml_head_params.php;h=08a792d5de295820bb0cf3caf95b37e82c4c69a1;hb=ada355332b092d2bd0ec7845f62c307587c9aab0;hp=6723455578bf8a400487128b77b79a942af3ded1;hpb=a11428ed0b4651895e27d6920c219d8d2476631c;p=living-lab-site.git diff --git a/application/libraries/Html_head_params.php b/application/libraries/Html_head_params.php index 6723455..08a792d 100644 --- a/application/libraries/Html_head_params.php +++ b/application/libraries/Html_head_params.php @@ -5,9 +5,10 @@ * included inside the head tag like: title, stylesheets, scripts and meta * information. * - * The constructor automatically adds the default stylesheet and default script - * if any from 'application/config/p2p-tube.php' so they don't have to be added - * manually. + * The constructor automatically adds the autoload-configured CSSs and JSs + * if any from "application/config/${site_config}.php" so they don't have to be + * added manually. The configuration parameters are: + * 'autoload_css', 'autoload_js'. * * The variables are passed as data in 'application/views/html_begin.php' which * is going to generate the tags based on their information. @@ -27,6 +28,8 @@ class Html_head_params { // Dictionary for meta tags: name => content public $metas; + protected $site_config = 'p2p-tube'; + /** * Initializes member variables with the parameters provided and adds the * default stylesheet to member $css and the default script to @@ -44,8 +47,11 @@ class Html_head_params { public function __construct($params) { $CI =& get_instance(); - $CI->load->helper('url'); - $CI->load->config('p2p-tube'); + + if (isset($this->site_config)) + $CI->load->config($this->site_config); + else + { /* TODO: no site config*/ } if (isset($params['title'])) $this->title = $params['title']; @@ -68,10 +74,10 @@ class Html_head_params { $this->metas = array(); // Default parameters from configuration file - if ($CI->config->item('default_css') != '') - $this->css[] = $CI->config->item('default_css'); - if ($CI->config->item('default_js') != '') - $this->js[] = $CI->config->item('default_js'); + $this->css = array_merge( + $CI->config->item('autoload_css'), $this->css); + $this->js = array_merge( + $CI->config->item('autoload_js'), $this->js); // URL correct prefixes foreach ($this->css as $i => $val)