Welcome Guest, Not a member yet? Register   Sign In
include css and javascript
#1

[eluser]gevans[/eluser]
I've created a simple library class to allow the adding of javascript and css files via the controller. Your view file only need contain the following line of code;

<?=$this->assets->get_assets()?>


config/autoload.php
-------------------

$autoload['libraries'] = array('assets');


controller
----------

$this->assets->add_script(array('jquery', 'focusRemove.js'));


As documented in the file add_script() and add_style() can be the filename or an array of filenames. The filename does not require the extension (though it will work as normal if the extension is left in place as above).




Theme © iAndrew 2016 - Forum software by © MyBB