kallefrombosnia / CI-resource_loader_helper

Main purpose of this helper is to make easier loading of assets in views.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Resource loader

Resource loader is Codeigniter 3 helper for easier assets load.

You can also:

  • Dynamicly load assets in view
  • Single load, specific or multiple load of diffrent assets
  • Group loading by alias name
  • Media support (video & audio)
  • Support for object and embed

Resource loader is project inspired by headache of having multiple spam lines of html in php code where you need to include assets from distant folder. Resource loader fixes that problem.

Installation

Resource loader library requires PHP minimal 5.6.x to work and CodeIgniter 3.x version

To load this library manualy place

resource_loader_helper.php 

in

application/helpers

Also put

helper_config.php

in

application/config

Set own config values in resource_loader.php

To load library in project you can use CI autoload

$autoload['helper'] = array('resource_loader');

or load it manually

$this->load->helper('resource_loader');

Examples

See all examples of usage .

Normal assets load Note: edit config values to use this type of functions.

echo rl_favicon('test.ico');

will produce

<link rel="icon" type="image/x-icon" href="http://banlist/assets/img/test.ico">

Single assets load

echo rl_load('assets/css/css.css', 'css');

will produce

<link rel="stylesheet" type="text/css" href="http://banlist/assets/css/css/css.css" >

Multiple load

echo rl_img(['code.jpg', ['test' => '123']],['code.jpg', ['test' => '456']]);

will produce

<img src="http://banlist/assets/img/code.jpg" test="123"  />
<img src="http://banlist/assets/img/code.jpg" test="456"  />    

Group load Group loading is specific feature and it needs to be enabled in resource_loader.php config file. See example page for more informations.

Todos

Development

Want to contribute? Great! Open pull request with your changes or report bugs in issues.

About

Main purpose of this helper is to make easier loading of assets in views.


Languages

Language:PHP 100.0%