示例#1
0
文件: ViewPage.php 项目: olif-fm/olif
 public function __construct()
 {
     $this->controller = ControllerPage::getInstance();
     $this->model = ModelPage::getInstance();
     require_once CORE_ROOT . THREEPARTY_REQ . "template" . DIRECTORY_SEPARATOR . "Template.php";
     $this->template = new \Template(WEBSITE_ROOT . 'templates' . DIRECTORY_SEPARATOR, WEBSITE_ROOT . 'cache/');
 }
示例#2
0
 public static function tokenDefault(&$token, &$text)
 {
     if ($token['type'] == 'text') {
         $text .= $token['data'];
     } else {
         if ($token['type'] == 'tag' && strtoupper($token['name']) == 'COMPONENT') {
             $name = $token['data']['name'];
             $component = SystemComponent::getComponentByName($name);
             if ($component !== null) {
                 $text .= '<?php $data = ' . var_export($token['data'], true) . '; $flags = ' . var_export($token['flags'], true) . '; ?>';
                 // Sustituyo esto:
                 //$text .= $component->getPHP();
                 // Por esto otro:
                 $html = $component->getPHP();
                 $ctokens = TreeScript::getParse($html);
                 $ctext = '';
                 foreach ($ctokens as $ctoken) {
                     RenderToken::tokenDefault($ctoken, $ctext);
                 }
                 $text .= $ctext;
                 // FIN
                 ControllerPage::requireComponent($name);
             }
         } else {
             if ($token['type'] == 'tag' && $token['name'] == '') {
                 $text .= '';
             } else {
                 //$text .= '';
             }
         }
     }
 }
示例#3
0
文件: Main.class.php 项目: fulldump/8
 /** This method is the main controller */
 public static function serveWeb()
 {
     if (Config::get('PROFILING_ENABLED')) {
         Profiling::start('index');
     }
     $url = $_SERVER['REQUEST_URI'];
     $hash = md5($url);
     if (!@(include 'cache/' . $hash)) {
         Router::setUrl($url);
         switch (Router::$node->getProperty('type')) {
             case 'page':
             case 'root':
                 ControllerPage::compile();
                 break;
             case 'php':
                 ControllerPhp::compile();
                 break;
         }
     }
     if (Config::get('PROFILING_ENABLED')) {
         Profiling::end();
     }
 }
示例#4
0
 protected function getControllerPage()
 {
     if (!class_exists('ControllerPage')) {
         require_once CORE_ROOT . CONTROLLERS . DIRECTORY_SEPARATOR . 'ControllerPage.php';
     }
     if (!is_object($this->page)) {
         $this->page = ControllerPage::getInstance();
     }
 }