Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.markdown #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
48 changes: 48 additions & 0 deletions README.markdown
Expand Up @@ -55,3 +55,51 @@ For specific usage and documentation, see:
[PHP Mustache](http://github.com/bobthecow/mustache.php)

[Original Mustache](http://mustache.github.com/)

## Additional Example (KOstache for Dummies)

To use, simply create a POPO (Plain Old PHP Object) like so: Under Controller/View create Test.php.

```php
<?php

class View_Test
{
public $title;

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

And modify the Controller/Welcome.php that comes default with Kohana.

```php
<?php
public function action_index() {
$view = new View_Test;
$view->title = "hello World"; or //Kohana::$config->load("site.title");
$this->response->body(Kostache::factory()->render($view));
}
```

And create test.mustache in classes/templates subdir:

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>{{title}}</title>
</head>
<body>
<h1>{{title}}</h1>
<p>{{testing}}</p>

</body>
</html>
```