From terminal, you must have sparks installed prior, see sparks page for instructions.
[bash]
cd /path_to_your_CI_reactor_build
php tools/spark install fire_log
( x.x indicates the version you have installed on your build )
// from some controller
function __construct()
{
$this->load->spark( 'auto/x.x' );
}
function get_users()
{
$this->auto->your_model->some_method();
//notice that I never loaded "your_model"?
}
function some_method()
{
/*
* you have reference to CI instances from anywhere,
* if it does not exist its created on the fly for you.
*/
$msg = Auto::inst()->lang->line( 'language_key' );
// much less verbose to do something like using models within other models
}
The below example is from a view, but could be anywhere.
The _helper suffix is not needed in all cases, but if you are in site controller, and trying to load site_helper dynamically, then you would need the suffix to prevent collision, thus it's better to get in the habit of using Form_helper::form_open_(); instead of Form::form_open();
/*
* load helpers only when each method is used
* the classname tells Auto which helper file to load,
* in this case url_helper would be Url::desired_method()
*/
echo Url_helper::anchor( 'http://www.google.com', 'Go to google' );
echo Text_helper::character_limiter( 'Lorem ipsum dolor sit amet, consectetur adipisicing', 10 );
// can call libraries ( instantiated or not ) from views as well.
$data = array( array('Name', 'Color', 'Size') );
echo Auto::inst()->table->generate( $data );
// or if in CI scope...
echo $this->auto->table->generate( $data );
the highest version folder in the spark folder will be loaded.
// if the spark is a library you can method chain such as
Auto::inst()->example_spark->some_lib_method();
/*
* but, if its just helpers, you will have to call those as you normally would,
* so you dont gain a whole lot in this case vs loading manually, only havig to know the version #
*/
Auto::inst()->example_spark;
some_spark_helper_method();
Spark Page
Log Issues or Suggestions