示例#1
0
文件: View.php 项目: mermetbt/biome
 public function load($controller, $action)
 {
     /**
      * Opening template file
      */
     $dirs = \Biome\Biome::getDirs('views');
     $template_file = '';
     foreach ($dirs as $dir) {
         $path = $dir . '/' . $controller . '.xml';
         if (!file_exists($path)) {
             continue;
         }
         $template_file = $path;
     }
     if (!file_exists($template_file)) {
         throw new \Biome\Core\View\Exception\TemplateNotFoundException('Missing template file for ' . $controller . '->' . $action);
     }
     $tree = TemplateReader::loadFilename($template_file);
     View\Component::$view = $this;
     if ($tree['value'] instanceof \Biome\Component\ViewsComponent) {
         $node = $tree['value'];
         $node->load($action);
         $this->_tree = $node;
     }
 }
示例#2
0
 public function building()
 {
     $filename = $this->getAttribute('src');
     $dirs = \Biome\Biome::getDirs('views');
     $template_file = '';
     foreach ($dirs as $dir) {
         $path = $dir . '/' . $filename;
         if (!file_exists($path)) {
             continue;
         }
         $template_file = $path;
     }
     if (!file_exists($template_file)) {
         throw new \Exception('Unable to load template file: ' . $filename);
     }
     $nodes = TemplateReader::loadFilename($template_file);
     // 		print_r($nodes);
     //
     // 		echo '<br/>';
     // 		print_r($this->value);
     // 		die();
     $this->_value = $nodes['value']->_value;
     return TRUE;
 }