コード例 #1
0
ファイル: Mustache.php プロジェクト: packfire/mustache
 /**
  * Get the partial by name and add to the buffer
  * @param string $name Name of the partial
  * @return string Returns the rendered buffer
  * @since 1.0-sofia
  */
 protected function partial($name, $scope)
 {
     $buffer = '';
     if ($this->loader) {
         $template = $this->loader->load($name);
         if ($template) {
             $partial = new Mustache($template);
             $partial->parameters($this->parameters)->loader($this->loader)->escaper($this->escaper);
             $buffer .= $partial->render($scope);
         }
     }
     return $buffer;
 }
コード例 #2
0
ファイル: MustacheTest.php プロジェクト: packfire/mustache
 public function testComment()
 {
     $mustache = new Mustache();
     $mustache->template('Jump over the {{name}} {{! pretty sure you can\'t make it there!}}!');
     $output = $mustache->parameters(array('name' => 'moon'))->render();
     $this->assertEquals('Jump over the moon !', $output);
 }