Welcome Guest, Not a member yet? Register   Sign In
Css/Js Assets
#1

[eluser]porquero[/eluser]
I've created this library to make easy using css or js files with views/templates.
Its use it is very easy, although with a template it is more useful.

How it works

This library find css/js files with same name that controller and view, and load these files (if exists):

controller.css
controller_view.css
controller.js
controller_view.js
You only add the file/s in the corresponding directory, and the library loads automatically it. ¿Easy no?


Configuration

You can configure directory names in config.php file:

$config['assets_dir'] = 'pub'; //Default is pub
$config['assets_css_dir'] = 'css'; //Default is css
$config['assets_js_dir'] = 'js'; //Default is js

Note: assets_css_dir and assets_js_dir works into assets_dir directory

So the file structure would see like this:

/pub
/pub/css
/pub/js

Note: Don't forget create directories.

Calling to the Library

In view/template into <head> tag add this code:

Code:
<?php Assets::get();?>

I hope it will be useful.

Download Assets




Theme © iAndrew 2016 - Forum software by © MyBB