Welcome Guest, Not a member yet? Register   Sign In
Loader extension - JavaScript and CSS loading functionality
#1

[eluser]Marfo[/eluser]
Hi!

This is my first CI extension/library whatever, so behave Smile.

Usage:

Controller
Code:
$this->load->set_script_path('js/');
$this->load->set_css_path('css/');

$this->load->set_script_extension('.js'); //Not necessary. Default is .js
$this->load->set_css_extension('.css'); //Not necessary. Default is .css

$this->load->script(array('jquery', 'scripts'));
$this->load->css(array('styles', 'ie'));

//Or you can set the extension in the script/css method like this
$this->load->script(array('jquery', 'scripts'), '.js');
$this->load->css(array('styles', 'ie'), '.js');
//Or like this
$this->load->script(array('jquery.js', 'scripts.php'), false);
$this->load->css(array('styles.css', 'ie.css'), false);

$this->load->view('welcome_message');

view/welcome_message
Code:
echo $loader_scripts;
//Or
echo $loader_css;
//Or
echo $this->output('scripts/css'); //empty will return both scripts and css

Or in the controller:
Code:
$data['scripts'] = $this->output('scripts');
$data['css'] = $this->output('css');

$this->load->view('welcome_message', $data);

Useful or crap?


Messages In This Thread
Loader extension - JavaScript and CSS loading functionality - by El Forum - 11-13-2009, 05:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB