Stencil CodeIgniter 模板引擎

程序名称:Stencil

授权协议: MIT

操作系统: 跨平台

开发语言: PHP

Stencil 介绍

Stencil 是一个 CodeIgniter
的模板引擎,通过简单可靠的方式来渲染 HTML 页面。

控制器:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

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 */

模板:

<!doctype html>
<html>
<head>
    <!-- robot speak -->    
    <meta charset="utf-8">
    <title><?php echo $title; ?> | My Stencil Website</title>
    <?php echo chrome_frame(); ?>
    <?php echo view_port(); ?>
    <?php echo apple_mobile('black-translucent'); ?>
    <?php echo $meta; ?><!-- //loads data from $this->stencil->meta($args) in controller -->

    <!-- icons and icons and icons and icons and icons -->
    <?php echo favicons(); ?>

    <!-- crayons and paint -->  
    <?php echo add_css(array('bootstrap', 'style')); ?>
    <?php echo $css; ?><!-- //loads data from $this->stencil->css($args) in controller -->

    <!-- magical wizardry -->
    <?php echo jquery('1.9.1'); ?>
    <?php echo shiv(); ?>
    <?php echo add_js(array('bootstrap.min', 'scripts')); ?>
    <?php echo $js; ?><!--  //loads page specific $this->stencil->js($args) from Controller (see docs) -->
</head>
<!-- $body_class will always be the class name -->
<body class="<?php echo $body_class; ?>">

    <header>
        <?php echo $header; ?>
    </header>

    <h1><?php echo $welcome_message; ?></h1>

    <section class="content">
        <?php echo $content; ?><!-- This loads home_view -->
    </section>

    <footer>
        <?php echo $footer; ?>
    </footer>

</body>
</html>

Stencil 官网

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

相关编程语言

BlazeDS 是一个基于服务器的Java 远程控制(remoting...
OVal 是一个可扩展的Java对象数据验证框架,验证的规...
Volta 是一套开发工具,专为开发分布式、实时系统应...
OpenDDS 是一个开源的 C++ 实现的 对象管理组织 OMG...
JADE (Java Agent DEvelopment Framework) 是一个完...
FastMM ,在D2006和2007中已代替了原来的内存管理器。