Пример #1
0
 public static function default_view($view = null)
 {
     ///N:create a default template and prints its content on commit
     ///P:$view:An optional string with a view's name or an instance of rea_view or rea_template, if non is given the 'default_page' will be loaded.
     global $rea_app_controller_page, $rea_views_path;
     if ($rea_app_controller_page == null) {
         if ($view == null) {
             $rea_app_controller_page = rea_view::createWithSource('default_page', file_get_contents(REA_ENGINE_PATH . 'views/default.view.html'));
         } elseif (is_object($view) && is_a($view, 'rea_template')) {
             $rea_app_controller_page = $view;
         } else {
             $rea_app_controller_page = rea_view::create($view);
         }
         $m = function () {
             global $rea_app_controller_page;
             global $rea_controller;
             $rea_controller->dispatchEvent("default_view_commit", array($rea_app_controller_page));
             print $rea_app_controller_page->getHTML();
         };
         rea_app_controller::on('app_commit_web', $m);
         rea_app_controller::on('default_view_commit', 'rea_views::attachJSBToView');
     }
     return $rea_app_controller_page;
 }