Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scotch-io/stencil

Stencil is an awesome and simple templating engine for Codeigniter.
https://github.com/scotch-io/stencil

Last synced: 8 days ago
JSON representation

Stencil is an awesome and simple templating engine for Codeigniter.

Awesome Lists containing this project

README

        

![Stencil Logo](http://scotch.io/wp-content/uploads/2013/09/codeigniter-stencil-1024x426.jpg "Stencil Logo")

Stencil :fire: :pencil2:
===========================

Stencil is a Codeigniter template engine for generating HTML pages in a simple yet very robust and powerful way.

It's awesome template system for Codeigniter. Stencil is the perfect out-of-the-box solution for all your Codeigniter projects.

### [View the Official Docs](http://scotch.io/docs/stencil)
### [Play with the Demo](http://stencil.scotch.io)

[email protected] or [email protected]

## Features

##### Layouts
##### Codeigniter 2.1.3 Ready
##### Slices
`Child Views`
`Partials`
`Nested Views`
`Elements`
`Includes`
##### HTML5 Helpers
`add_css()`
`add_js()`
`add_meta()`
`shiv()`
`chrome_frame()`
`view_port()`
`apple_mobile()`
`windows_tile()`
`favicons()`
`jquery()`
`asset_url()`
##### Load Page Specific Assets
`JS`
`CSS`
`Perfect for jQuery Plugins`
##### Slice Callbacks
`Run or return a block of code everytime a view is called`
##### Asset Management
##### Smart Data Binding to Views
`$this->stencil->data('key', 'value')`
`$this->stencil->data(array('key' => 'value'))`

## Example Use

![Stencil Default Layout](http://scotch.io/images/stencil-demo.png "Stencil Logo")

### Controller
```php
stencil->layout('home_layout');
$this->stencil->slice('header');
$this->stencil->slice('footer');
}

public function index()
{
$this->stencil->title('Home Page');

$this->stencil->js('some-plugin');
$this->stencil->js('home-slider');
$this->stencil->css('home-slider');

$this->stencil->meta(array(
'author' => 'Nicholas Cerminara',
'description' => 'This is the home page of my website!',
'keywords' => 'stencil, example, fun stuff'
));

$data['welcome_message'] = 'Welcome to my website using Stencil!';
$this->stencil->paint('home_view', $data);
}
}

/* End of file home.php */
/* Location: ./application/controllers/home.php */
```

### Layout
#### (/views/layouts/..)
```php



| My Stencil Website






























```

### Result

```php



Home Page | My Stencil Website






























This came from "/views/slices/header.php"


Welcome to my website using Stencil!




This content came from "/views/pages/home_view.php"



This is my footer!


```

## License
Copyright (c) 2013. scotch.io

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

## Need Help? Questions? Have a bug?
Open an issue in the Github tab. Send a pull request. Thanks.