How to add dynamic CSS and JS - need help |
Hi, I'm new to CodeIgniter.
I've been trying to use this code http://dondanu.com/add-dynamic-css-and-j...deigniter/ (another article i've found was 2013 http://jamshidhashimi.com/2013/04/12/dyn...ader-page/ ) It says: 1. Add new config item in your config file: PHP Code: $config['css_path'] = 'assets/css/'; 2. Create new helper file “helper/queuescript_helper.php” 3. In your controller file use below code, PHP Code: $data['css'] = array('bootstrap.css','custom.css'); 4. In your view, PHP Code: <?php queue_css($css);?> *** I ended up with this code (after rewriting it a bit): PHP Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); I added queuescript into autoload: PHP Code: $autoload['helper'] = array('html', 'url', 'queuescript'); There was an error: "Undefined variable: atts" and "Invalid argument supplied for foreach()" line 27, that is: PHP Code: foreach ( $atts as $key => $val ) But I added $atts = array() into line 21 PHP Code: queue_css($file, $media='all',$atts = array()) My base url is http://localhost/public_html path to css folder is: public_html/styles js folder is next to the codeigniter application folder in config I've got (I tried all variants of path): PHP Code: $config['css_path'] = 'styles/'; My browser doesn't see nor js nor css files. (I've restarted my wamp server). Please, help! |
Messages In This Thread |
How to add dynamic CSS and JS - need help - by KarinaRode - 01-29-2016, 03:58 AM
RE: How to add dynamic CSS and JS - need help - by DreamOfSleeping - 01-29-2016, 08:48 AM
RE: How to add dynamic CSS and JS - need help - by DreamOfSleeping - 01-29-2016, 08:55 AM
RE: How to add dynamic CSS and JS - need help - by KarinaRode - 01-29-2016, 09:42 AM
RE: How to add dynamic CSS and JS - need help - by KarinaRode - 01-29-2016, 12:36 PM
|