Deprecated: Assigning the return value of new by reference is deprecated in /home/thomastr/CodeIgniter_1.6.1/system/codeigniter/Common.php on line 123

Deprecated: Assigning the return value of new by reference is deprecated in /home/thomastr/CodeIgniter_1.6.1/system/codeigniter/Common.php on line 129

A PHP Error was encountered

Severity: 8192

Message: Function set_magic_quotes_runtime() is deprecated

Filename: codeigniter/CodeIgniter.php

Line Number: 53


Notice: Use of undefined constant APPPATH - assumed 'APPPATH' in /home/thomastr/CodeIgniter_1.6.1/system/libraries/Loader.php on line 248

Notice: Use of undefined constant EXT - assumed 'EXT' in /home/thomastr/CodeIgniter_1.6.1/system/libraries/Loader.php on line 248

Warning: include(APPPATHerrors/error_phpEXT) [function.include]: failed to open stream: No such file or directory in /home/thomastr/CodeIgniter_1.6.1/system/libraries/Loader.php on line 248

Warning: include(APPPATHerrors/error_phpEXT) [function.include]: failed to open stream: No such file or directory in /home/thomastr/CodeIgniter_1.6.1/system/libraries/Loader.php on line 248

Warning: include() [function.include]: Failed opening 'APPPATHerrors/error_phpEXT' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/thomastr/CodeIgniter_1.6.1/system/libraries/Loader.php on line 248

A PHP Error was encountered

Severity: 8192

Message: Function ereg() is deprecated

Filename: libraries/Config.php

Line Number: 177

Welcome - Template Class - codeigniter - tomcode.com

Welcome

This template class caches vars in arrays, and can add entries to already cached vars. It can also insert CSS <link> and Javascript file <script> HTML tags.

Used to exist as an extension to the CI Loader class, for compatibility reasons to modular_extensions of wiredesignz. I've switched to a self contained library with the inconveniance to especially need to fetch the vars in the main view.

Usage

Defining / adding vars

add var_name to the cached vars
$this->template->add_var('var_name', $values)

add file_name to the CSS files to include
$this->template->css('file_name')

add file_name to the Javascript files to include
$this->template->js('file_name')

If the class is used as MY_Loader all defined vars are automatically available in all views ! Calls are $this->load->css() instead of $this->template->css().

Retrieving vars / file calls

fetch the cached var var_name
$this->template->get_var('var_name')

insert all CSS file calls into view
$this->template->css_files()

insert all Javascript file calls into view
$this->template->js_files()