MDL-74741 javascript: A11y fix for dialogues visible from beginning
[moodle.git] / lib / mustache / README.md
bloba596ace8dee63a148e3c1efccbb2859d0997d689
1 Mustache.php
2 ============
4 A [Mustache](http://mustache.github.com/) implementation in PHP.
6 [![Package version](http://img.shields.io/packagist/v/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
7 [![Build status](http://img.shields.io/travis/bobthecow/mustache.php/dev.svg?style=flat-square)](http://travis-ci.org/bobthecow/mustache.php)
8 [![StyleCI](https://styleci.io/repos/569670/shield)](https://styleci.io/repos/569670)
9 [![Monthly downloads](http://img.shields.io/packagist/dm/mustache/mustache.svg?style=flat-square)](https://packagist.org/packages/mustache/mustache)
12 Usage
13 -----
15 A quick example:
17 ```php
18 <?php
19 $m = new Mustache_Engine;
20 echo $m->render('Hello {{planet}}', array('planet' => 'World!')); // "Hello World!"
21 ```
24 And a more in-depth example -- this is the canonical Mustache template:
26 ```html+jinja
27 Hello {{name}}
28 You have just won {{value}} dollars!
29 {{#in_ca}}
30 Well, {{taxed_value}} dollars, after taxes.
31 {{/in_ca}}
32 ```
35 Create a view "context" object -- which could also be an associative array, but those don't do functions quite as well:
37 ```php
38 <?php
39 class Chris {
40     public $name  = "Chris";
41     public $value = 10000;
43     public function taxed_value() {
44         return $this->value - ($this->value * 0.4);
45     }
47     public $in_ca = true;
49 ```
52 And render it:
54 ```php
55 <?php
56 $m = new Mustache_Engine;
57 $chris = new Chris;
58 echo $m->render($template, $chris);
59 ```
62 And That's Not All!
63 -------------------
65 Read [the Mustache.php documentation](https://github.com/bobthecow/mustache.php/wiki/Home) for more information.
68 See Also
69 --------
71  * [Readme for the Ruby Mustache implementation](http://github.com/defunkt/mustache/blob/master/README.md).
72  * [mustache(5)](http://mustache.github.com/mustache.5.html) man page.