|
@@ -15,7 +15,6 @@ include('Mustache.php');
|
|
|
$m = new Mustache;
|
|
$m = new Mustache;
|
|
|
echo $m->render('Hello {{planet}}', array('planet' => 'World!'));
|
|
echo $m->render('Hello {{planet}}', array('planet' => 'World!'));
|
|
|
// "Hello World!"
|
|
// "Hello World!"
|
|
|
-
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
@@ -29,6 +28,7 @@ Well, ${{taxed_value}}, after taxes.
|
|
|
{{/in_ca}}
|
|
{{/in_ca}}
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+
|
|
|
Along with the associated Mustache class:
|
|
Along with the associated Mustache class:
|
|
|
|
|
|
|
|
```php
|
|
```php
|
|
@@ -43,18 +43,18 @@ class Chris extends Mustache {
|
|
|
|
|
|
|
|
public $in_ca = true;
|
|
public $in_ca = true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+
|
|
|
Render it like so:
|
|
Render it like so:
|
|
|
|
|
|
|
|
```php
|
|
```php
|
|
|
<?php
|
|
<?php
|
|
|
$chris = new Chris;
|
|
$chris = new Chris;
|
|
|
echo $chris->render($template);
|
|
echo $chris->render($template);
|
|
|
-
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+
|
|
|
Here's the same thing, a different way:
|
|
Here's the same thing, a different way:
|
|
|
|
|
|
|
|
Create a view object--which could also be an associative array, but those don't do functions quite as well:
|
|
Create a view object--which could also be an associative array, but those don't do functions quite as well:
|
|
@@ -71,9 +71,9 @@ class Chris {
|
|
|
|
|
|
|
|
public $in_ca = true;
|
|
public $in_ca = true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
+
|
|
|
And render it:
|
|
And render it:
|
|
|
|
|
|
|
|
```php
|
|
```php
|
|
@@ -81,7 +81,6 @@ And render it:
|
|
|
$chris = new Chris;
|
|
$chris = new Chris;
|
|
|
$m = new Mustache;
|
|
$m = new Mustache;
|
|
|
echo $m->render($template, $chris);
|
|
echo $m->render($template, $chris);
|
|
|
-
|
|
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
|