2017 © Pedro PelĆ”ez
 

cakephp-plugin cakephp-mustache

Simple CakePHP View Helper Plugin for the Mustache template assets

image

nod.st/cakephp-mustache

Simple CakePHP View Helper Plugin for the Mustache template assets

  • Friday, September 6, 2013
  • by JacopKane
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

CakePHP Mustache Helper Plugin

A helper for configuring and wrapping methods for the Mustache template engine., (*1)

Configuring

Install it from command line with the Composer in your project:, (*2)

composer require nod.st/cake-mustache

Load the plugin in your:, (*3)

<?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.), (*4)

<?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:, (*5)

<?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:, (*6)

<!-- ./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:, (*7)

<?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., (*8)

The Versions

06/09 2013

dev-master

9999999-dev

Simple CakePHP View Helper Plugin for the Mustache template assets

  Sources   Download

The Requires

 

06/09 2013

v0.0.4

0.0.4.0

Simple CakePHP View Helper Plugin for the Mustache template assets

  Sources   Download

The Requires

 

06/09 2013

v0.0.3

0.0.3.0

Simple CakePHP View Helper Plugin for the Mustache template assets

  Sources   Download

The Requires