Explorar el Código

Update README to reflect preferred mustache class implementation. Rendering arbitrary generic view class/array and template is secondary.

Justin Hileman hace 15 años
padre
commit
fa8c81dcfd
Se han modificado 1 ficheros con 20 adiciones y 11 borrados
  1. 20 11
      README.markdown

+ 20 - 11
README.markdown

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