danieltorscho / ci_template_lib
Simple template library with some core functionalities to simplify the development process for CodeIgniter 2.x
Installs: 8
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/danieltorscho/ci_template_lib
Requires
- php: >=5.2.4
This package is not auto-updated.
Last update: 2023-01-16 23:28:48 UTC
README
Simple template library with some core functionalities to simplify the development process for CodeIgniter 2.x.
How to use
- Extract all files to your project root directory. Make sure to overwrite all files if prompted.
- Open
app/config/autoload.php, add'template'to$autoload['libraries']and$autoload['config']. - Edit your template configuration file
application/config/template.php. - Navigate to
yourwebsite.dev/index.php/welcome.
Template library handles most of the views logic on its own.
With simple $this->template->load(); call inside the controller's method, it will automatically create pagetitle, pagename, scripts, stylesheets variables and subload a corresponding subview file controller/method.php if nothing was provided in load() function.
Documentation
Load custom view file:
$this->template->load('path/to/view.php');
Load custom view file within a custom template file:
$this->template->load('template/login', 'user/login/form');
Set custom page title:
$this->template->title('Product page');
Set custom breadcrumbs:
$this->template->crumb('E-commerce', 'ecommerce/index');
$this->template->crumb('Products', 'ecommerce/products');
$this->template->crumb('Product #391');
Add custom JavaScript file loading:
$this->template->script('plugin/head.js', TRUE)
$this->template->script('footer.js');
Add custom CSS file loading:
$this->template->css('print.css', 'print');
Set custom variables:
$this->template->set_item('articles', $articles); // Now you are able to use $articles inside all subviews