Created
December 20, 2012 18:31
-
-
Save whatnickcodes/4347531 to your computer and use it in GitHub Desktop.
Sample Stencil Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
class Example extends CI_Controller { | |
function __construct() | |
{ | |
parent::__construct(); | |
//slices are reusable parts of your views | |
$this->stencil->slice(array('header', 'footer')); | |
//set which layout you would like to use | |
$this->stencil->layout('subpage_layout'); | |
} | |
function index() | |
{ | |
//sets a title variable in your views | |
$this-stencil->title('Example Page'); | |
//optional: add additional page specific CSS | |
$this->stencil->css('custom1'); | |
$this->stencil->css('custom2'); | |
//optional: add additional page specific js | |
$this->stencil->js(array('slider', 'lightbox')); | |
//optional: add page specific meta data | |
$this->stencil->meta(array( | |
'keywords' => 'Stencil, Codeigniter, Template, Awesome!', | |
'description' => 'This is the meta description!' | |
)); | |
//load the content/page to be shown in the layout | |
$this->stencil->paint('one_view'); | |
} | |
} | |
/* End of file example.php */ | |
/* Location: ./application/controllers/example.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment