Ubiquity  2.0.2
php rapid development framework
TemplateParser.php
Go to the documentation of this file.
1 <?php
2 
4 
11  private $fileContent;
12 
13  public function __construct($fileName) {
14  $this->fileContent=file_get_contents($fileName);
15  }
16 
17  private function parse($html) {
18  $startPoint='{{';
19  $endPoint='}}';
20  $result=preg_replace('/(' . preg_quote($startPoint) . ')(.*?)(' . preg_quote($endPoint) . ')/sim', '<?php echo $2 ?>', $html);
21  return $result;
22  }
23 
24  public function __toString() {
25  return $this->parse($this->fileContent);
26  }
27 }
Moteur de template pour les fichiers d&#39;extension phtml.