承接 nod.st/cakephp-mustache 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nod.st/cakephp-mustache

Composer 安装命令:

composer require nod.st/cakephp-mustache

包简介

Simple CakePHP View Helper Plugin for the Mustache template assets

README 文档

README

A helper for configuring and wrapping methods for the Mustache template engine.

Configuring

Install it from command line with the Composer in your project:

composer require nod.st/cake-mustache

Load the plugin in your:

<?php
//./Config/bootstrap.php
CakePlugin::load(array(
    'CakeMustache'  => array(
        'bootstrap' => true
    )
));
?>

Add it to a Controller: (Note: Below option values are default settings, and you don't need to pass them as long as you would like to change it.)

<?php
//./Controller/AppController.ctp
class AppController extends Controller {
    public $helpers = array(
        'CakeMustache.Mustache' => array(
            'path'          => './../webroot/mustache',
            'extension'     => 'mustache',
            'viewVariables' => true
        )
    );
}
?>

Optionally you can also change set the path with Configure class with:

<?php
//For example, ./Config/bootstrap.php
Configure::write('Mustache.path', '/my/custom/and/awesome/folder/path/to/mustache/templates');
?>

Create some mustache templates for being sure it's working:

<!-- ./webroot/mustache/test.mustache -->
<p>Test1: {{text}}</p>
{{> test2}}
<!-- ./webroot/mustache/test2.mustache -->
<p>Test2: {{text}}</p>

You can now render the template on your views:

<?php
//./View/Layouts/default.ctp
echo $this->Mustache->render('test.mustache', array(
    'text'  => 'Hello Mustache!'
));
?>

Is it working? Awesome! No? Then you're welcome to create an issue with some details.

统计信息

  • 总下载量: 16
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-09-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固