/mustacheview

Bundle for Laravel which allows you to use mustache templates in your views

Primary LanguagePHP

Mustache View

Tiny bundle for Laravel which allows you to use the mustache template language for your views. It uses the mustache.php class built by bobthecow and renders files with the extension ".mustache".

Installaton

Installing the bundle is done in 3 easy steps:

  1. Download the source
  2. Register the bundle
  3. Change the view alias

Download

Download/clone the source into your bundles directory.

Bundle Registration

Register the bundle in your application/bundles.php file.

'mustacheview' => array(
	'autoloads' => array(
		'map' => array(
			'Mustache\\View' => '(:bundle)/view.php',
			'Mustache\\Mustache' => '(:bundle)/mustache.php'
		)
	)
)

Change View Alias

This view extends the Laravel\View class and replaces it to provide mustache functionality, so you'll need to modify your application/config/application.php file, replacing the 'View' alias with one that points to the mustache view.

'aliases' => array(
	...
	'View' => 'Mustache\\View',
)

Usage

The view should work like any other view, other than the fact that you use mustache files (with the file extension '.mustache') to build your templates rather than PHP files. This does mean that none of the helper functions are available, so build your controllers accordingly.

For information about the mustache syntax, see the manual: mustache(5)

License

Copyright (c) 2012 The Lonely Coder

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  • The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  • Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  • This notice may not be removed or altered from any source distribution.