Ubiquity  2.0.3
php rapid development framework
MicroTemplateEngine.php
Go to the documentation of this file.
1 <?php
2 
4 
8 
10  private $viewsFolder;
11 
12  public function __construct() {
13  $this->viewsFolder=ROOT . DS . "views/";
14  }
15 
16  /*
17  * (non-PHPdoc)
18  * @see TemplateEngine::render()
19  */
20  public function render($viewName, $pData, $asString) {
21  $config=Startup::getConfig();
22  $fileName=$this->viewsFolder . $viewName;
23  if (is_array($pData)) {
24  extract($pData);
25  }
26  $tpl=new TemplateParser($fileName);
27  $content=eval('?>' . $tpl->__toString());
28  if ($asString)
29  return $content;
30  else
31  echo $content;
32  }
33  public function getBlockNames($templateName) {
34  return [];
35  }
36 
37  public function getCode($templateName){
38  $fileName=$this->viewsFolder . $templateName;
39  return UFileSystem::load($fileName);
40  }
41 
42 }
Moteur de template pour les fichiers d&#39;extension phtml.