Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/patricknelson/stache
Bastardized version of "Mustache" without any of the feature richness.
https://github.com/patricknelson/stache
Last synced: 25 days ago
JSON representation
Bastardized version of "Mustache" without any of the feature richness.
- Host: GitHub
- URL: https://github.com/patricknelson/stache
- Owner: patricknelson
- License: mit
- Created: 2014-06-18T19:31:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-18T19:56:30.000Z (over 10 years ago)
- Last Synced: 2024-05-17T00:19:14.129Z (6 months ago)
- Language: PHP
- Size: 152 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Stache #
Bastardized version of [Mustache](http://mustache.github.io/) without any of the feature richness.
# Usage #
Taken from [the fully featured](https://github.com/bobthecow/mustache.php) PHP implementation of Mustache, the syntax is very similar and limited to one main method:
```php
render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
```You can also define values using the separate `->assign()` method, like this:
```php
// Typical associative array.
$s->assign(array(
"foo" => "oof",
"bar" => "rab",
));// Direct assignment.
$s->assign("baz", "zab");// Define a template and render a result.
$template = '
foo: {{foo}}
bar: {{bar}}
baz: {{baz}}
';
echo $s->render($template);
```Outputs:
foo: oof
bar: rab
baz: zab