Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d7ca68388d
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (35 sloc) 2.377 kb

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.
Jump to Line
Something went wrong with that request. Please try again.