1
0
Fork 0
Go to file
Ando Roots 4a48b5f7ae Fix links to original mustache in the Readme 2012-11-22 13:27:47 +02:00
classes Fix PSR-0 issue with html class. Fixes #45 2012-11-05 06:32:21 -06:00
config Userguide didn't show up in the browser, all fixed now 2011-05-13 08:16:11 +02:00
guide/kostache Merge branch 'develop' 2012-10-23 12:39:02 -05:00
templates Layout needs to reference "content" not "body", fixes #20 2011-03-29 11:26:52 -05:00
vendor Switch to mustache v2, not done 2012-10-23 18:17:02 -05:00
.gitignore Switch to mustache v2, not done 2012-10-23 18:17:02 -05:00
.gitmodules Converted vendor/mustache into a submodule 2010-07-07 23:39:25 +08:00
LICENSE.md Moved all copyrights to 2012 2012-01-08 19:12:53 -06:00
README.markdown Fix links to original mustache in the Readme 2012-11-22 13:27:47 +02:00
init.php Switch to mustache v2, not done 2012-10-23 18:17:02 -05:00

README.markdown

Kostache

Kostache is a Kohana 3 module for using Mustache templates in your application.

Usage

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

<?php

class View_Test
{
	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 = Kostache::factory();

And render it:

<?php

$this->response->body($renderer->render(new View_Test));

Templates

Templates should go in the templates/ directory in your cascading file system. 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 templates/partials/foobar.mustache.

Layouts

KOstache supports layouts. To use, just add a templates/layout.mustache file (a simple one is already provided), and use Kostache_Layout for your renderer instead of Kostache. 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