
Stencil


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.
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

Controller
class Home extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->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 echo $title; ?> | My Stencil Website<?php echo $welcome_message; ?>
Result
Home Page | My Stencil WebsiteThis 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.
Stencil是一个专为CodeIgniter设计的高效且强大的HTML页面生成模板引擎。它提供了布局、切片、部分视图等功能,完美适配CodeIgniter 2.1.3。特色包括HTML5助手、资源管理、数据绑定等,使得页面特定资产加载和jQuery插件的使用更加便捷。

被折叠的 条评论
为什么被折叠?



