コード例 #1
0
    /**
     * Função renderizadora das views
     * @access public
     * @param String $view
     * @return void
     */
    public function render($view)
    {
        $this->loadHelpers();
        $view = $view[0] == '/' ? substr($view, 1) : 'views/' . strtolower($this->request->controller_name) . '/' . $view;
        $content = $this->template->renderPage($view . ".php");
        // Para não redenrizar layout.
        // Setar no controller: var $layout = null;
        if (!empty($this->layout)) {
            $this->add('content', $content);
            $content = $this->template->fetch('views/layouts/' . $this->layout . '.php');
        }
        echo $content;
        if (BENCHMARK) {
            echo '<style type="text/css">
					div.cms_debug{
						background-color: white;
						position: fixed;
						bottom:0;
						-moz-box-shadow:0 -1px 4px #000;
						box-shadow:0 -1px 4px #000;
						-webkit-box-shadow:0 -1px 4px #000;
						padding: 2px 4px 0 4px;
						left:10px;
						opacity:0.3;
					}
					div.cms_debug:hover{
						opacity:1;
					}
				</style>';
            Benchmark::stop('Load Time');
            echo '<div class="cms_debug">';
            foreach (Benchmark::getTotals() as $total) {
                echo $total . '<br>';
            }
            echo '</div>';
        }
        die;
        // Para garantir e não chamar 2 render.
    }