Ejemplo n.º 1
0
 public function afterExecuteRoute($dispatcher)
 {
     return;
     //$this->response->setContent($this->htmlDoc);
     //$this->htmlDoc->getBody()->setContent($this->response->getContent());
     //$this->response->setContent($this->htmlDoc);
     //return $this->response->send();
     //$item = new Doc();
     $item = new HtmlModel(array('tag' => new Doc()));
     //var_dump ($doctag->getChild('html')->setAttribute('lang', 'gb'));
     echo '<pre><code>' . htmlentities($item) . '</code></pre>';
     return;
     $test = HtmlTag::factory(array('tagname' => 'doc', 'children' => array('doctype' => array('tagname' => 'doctype'))));
     echo '<pre><code>';
     var_dump($test);
     echo '</code></pre>';
     return;
     // Set up the assets manager to not output directly
     $this->assets->useImplicitOutput(false);
     // Compile everything into the assets manager
     foreach ($this->htmldoc['css'] as $css) {
         if (Text::startsWith($css, 'http')) {
             $this->assets->addCss($css, false);
         } elseif (Text::startsWith($css, 'files/')) {
             $this->assets->addCss($css);
         } else {
             $this->assets->addInlineCss($css);
         }
     }
     foreach ($this->htmldoc['js'] as $js) {
         if (Text::startsWith($js, 'http')) {
             $this->assets->addJs($js, false);
         } elseif (Text::startsWith($js, 'files/')) {
             $this->assets->addJs($js);
         } else {
             $this->assets->addInlineJs($js);
         }
     }
     $this->assets->collection('jsfooter');
     foreach ($this->htmldoc['jsfooter'] as $js) {
         if (Text::startsWith($js, 'http')) {
             $this->assets->collection('jsfooter')->addJs($js, false);
         } elseif (Text::startsWith($js, 'files/')) {
             $this->assets->collection('jsfooter')->addJs($js);
         } else {
             $this->assets->addInlineJs($js);
         }
     }
     $this->htmldoc['meta-src'] = '';
     foreach ($this->htmldoc['meta'] as $meta) {
         $this->htmldoc['meta-src'] .= $this->tag->tagHtml('meta', $meta, true, true, true);
     }
     // Create the css view variable
     $this->htmldoc['css-src'] = $this->assets->outputCss();
     $this->htmldoc['css-inline-src'] = $this->assets->outputInlineCss();
     // Create the javascript view variables
     // Inline scripts are separated
     $this->htmldoc['js-src'] = $this->assets->outputJs();
     $this->htmldoc['js-inline-src'] = $this->assets->outputInlineJs();
     // Create the footer javascript view variable
     $this->htmldoc['jsfooter-src'] = $this->assets->outputJs('jsfooter');
     // Create the import view variable
     $this->htmldoc['import-src'] = '';
     foreach ($this->htmldoc['import'] as $import) {
         $this->htmldoc['import-src'] .= $this->tag->tagHtml('link', array('rel' => 'import', 'href' => $this->url->get($import)), true, true, true);
     }
     // Create the menu items
     $this->htmldoc['menu-items'] = $this->_parse_menu_items($this->htmldoc['menu']);
     // Add the variables to the view
     $this->view->setVar('htmldoc', $this->htmldoc);
     $this->view->setVar('menu', $this->view->getPartial('shared/menu'));
 }