|
@@ -26,10 +26,10 @@ And a more in-depth example--this is the canonical Mustache template:
|
|
|
{{/in_ca}}
|
|
{{/in_ca}}
|
|
|
|
|
|
|
|
|
|
|
|
|
-Create a view object--which could also be an associative array, but those don't do functions quite as well:
|
|
|
|
|
|
|
+Along with the associated Mustache class:
|
|
|
|
|
|
|
|
<?php
|
|
<?php
|
|
|
- class Chris {
|
|
|
|
|
|
|
+ class Chris extends Mustache {
|
|
|
public $name = "Chris";
|
|
public $name = "Chris";
|
|
|
public $value = 10000;
|
|
public $value = 10000;
|
|
|
|
|
|
|
@@ -39,21 +39,22 @@ Create a view object--which could also be an associative array, but those don't
|
|
|
|
|
|
|
|
public $in_ca = true;
|
|
public $in_ca = true;
|
|
|
}
|
|
}
|
|
|
- ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-And render it:
|
|
|
|
|
|
|
+Render it like so:
|
|
|
|
|
|
|
|
<?php
|
|
<?php
|
|
|
- $chris = new Chris;
|
|
|
|
|
- $m = new Mustache;
|
|
|
|
|
- echo $m->render($template, $chris);
|
|
|
|
|
|
|
+ $c = new Chris;
|
|
|
|
|
+ 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:
|
|
|
|
|
+
|
|
|
<?php
|
|
<?php
|
|
|
- class Chris extends Mustache {
|
|
|
|
|
|
|
+ class Chris {
|
|
|
public $name = "Chris";
|
|
public $name = "Chris";
|
|
|
public $value = 10000;
|
|
public $value = 10000;
|
|
|
|
|
|
|
@@ -63,12 +64,20 @@ Here's the same thing, a different way:
|
|
|
|
|
|
|
|
public $in_ca = true;
|
|
public $in_ca = true;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- $c = new Chris;
|
|
|
|
|
- echo $chris->render($template);
|
|
|
|
|
?>
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+And render it:
|
|
|
|
|
+
|
|
|
|
|
+ <?php
|
|
|
|
|
+ $chris = new Chris;
|
|
|
|
|
+ $m = new Mustache;
|
|
|
|
|
+ echo $m->render($template, $chris);
|
|
|
|
|
+ ?>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
Known Issues
|
|
Known Issues
|
|
|
------------
|
|
------------
|
|
|
|
|
|