コード例 #1
0
ファイル: extended.php プロジェクト: soanni/mvc
 protected function _include($tree, $content)
 {
     $template = new Template(array('implementation' => new self()));
     $file = trim($tree["raw"]);
     $path = $this->getDefaultPath();
     $content = file_get_contents(APP_PATH . "\\{$path}\\{$file}");
     $template->parse($content);
     $index = $this->_index++;
     return "function anon_{$index}(\$_data){" . $template->getCode() . "};\$_text[] = anon_{$index}(\$_data);";
 }
コード例 #2
0
ファイル: extended.php プロジェクト: SwiftSchool/School
 /**
  * Fetch a subtemplate and place it within the main template. The subtemplate should be processed at the same time 
  * as the main template, so that any logic can happen at the same time.
  * 
  * @param type $tree
  * @param type $content
  * @return type
  */
 protected function _include($tree, $content)
 {
     $template = new Template(array("implementation" => new self()));
     $file = trim($tree["raw"]);
     $path = $this->defaultPath;
     $content = file_get_contents(APP_PATH . "/{$path}/{$file}");
     $template->parse($content);
     $index = $this->_index++;
     return "\$_anon = function(\$_data){\n                " . $template->code . "\n            };\$_text[] = \$_anon(\$_data);";
 }
コード例 #3
0
ファイル: extended.php プロジェクト: chapmang/phpframework
 /**
  * Fetch a sub-template and place within the main template
  * Both templates to be proceed at the same time  allowing
  * for the sharing of data
  * @param  array $tree    Node from the template tree
  * @param  mixed $content Content of node
  * @return string         Executable sub-template code 
  */
 protected function _include($tree, $content)
 {
     // New template instance allowing for the nesting
     // of templates, e.g., sub-templates can have sub-templates
     $template = new Template(array("implementation" => new self()));
     // Retrieve the file to include an parse its contents
     $file = trim($tree["raw"]);
     $path = $this->defaultPath;
     $content = file_get_contents(path('app') . "{$path}/{$file}");
     $template->parse($content);
     $index = $this->_index++;
     // Return the function generated by the template
     return "\$_anon = function(\$_data){\n                " . $template->code . "\n            };\$_text[] = \$_anon(\$_data);";
 }