Documentation:Autoload

From TinyMVC Documentation

Revision as of 18:44, 25 July 2012 by Admin (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Autoloading Plugins

Instead of using $this->load->library() and $this->load->script() in your controllers, you can have them autoloaded. Then they are always available to every controller.

myapp/configs/config_autoload.php

/* auto-loaded libraries */
$config['libraries'] = array('mylib','myotherlib');
 
/* auto-loaded scripts */
$config['scripts'] = array('myhelpers','myscripts');

Just add your plugins to the autoload arrays.

If you want to alias an autoloaded library, use an array:

/* auto-loaded libraries */
$config['libraries'] = array(
  array('mylib','myalias'),
  array('myotherlib','otheralias')
  );
Personal tools