- 授权协议: MIT
- 开发语言: PHP
- 操作系统: 跨平台
- 软件首页: https://github.com/scotch-io/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>
JAVASCRIPT语言精髓与编程实践
周爱民 / 电子工业出版社 / 2008-3 / 68.00元
《JAVASCRIPT语言精髓与编程实践》讲述了JavaScript的语言实现与扩展,主要包括以下三个方面的内容:(1)动态、函数式语言,以及其它语言特性在JavaScript的表现与应用;(2)如何用动态函数式语言的特性来扩展JavaScript的语言特性与框架;(3)如何将JavaScript引擎整合到其它高级语言的开发过程中。一起来看看 《JAVASCRIPT语言精髓与编程实践》 这本书的介绍吧!