Skip to content
This repository was archived by the owner on Nov 7, 2020. It is now read-only.

iksi/lastache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lastache

Lastache is a port of Kostache, a Kohana 3 module. With this package you can use Mustache templates in your application.

Usage

To use, simply create a POPO (Plain Old PHP Object) like so:

<?php

class TestView
{
	public $hello = 'world';

	public function testing()
	{
		return 'foobar';
	}
}

And create a mustache renderer. The parameter to the engine method is the template name to use.

<?php

$renderer = Lastache::factory();

And render it:

<?php

return $renderer->render(new TestView));

Templates

Templates should go in the app/templates/ directory. They should have a .mustache extension.

Partials

Partials are loaded automatically based on the name used in the template. So if you reference {{>foobar}} in your template, it will look for that partial in app/templates/partials/foobar.mustache.

Layouts

Lastache supports layouts. To use, just add a app/templates/layout.mustache file (a simple one is already provided), and use Lastache_Layout for your renderer instead of Lastache. You'll probably want to put a $title property in your view class. The layout should include a {{>content}} partial to render the body of the page.

Additional Information

For specific usage and documentation, see:

PHP Mustache

Original Mustache

About

Lastache, a port of KOstche by Zombor. Logicless templates using Mustache for Laravel.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages