开发者

Unable to get output of doctype in Zend Framework

开发者 https://www.devze.com 2023-01-28 03:58 出处:网络
In my bootstrap, I have this code, $view = new Zend_View(); $view->setEncoding(\'UTF-8\'); $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);

In my bootstrap, I have this code,

    $view = new Zend_View();
    $view->setEncoding('UTF-8');
    $viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
    Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
    $viewRenderer->initView();
    $viewRenderer->view->doctype('XHTML1_TRANSITIONAL');
    Zend_Layout::startMvc(
                    array(
                        'layoutPath' => dirname(__FILE__) . '/layouts/scripts/'
                    )
    );

In my layout.phtml, I have,

<?php echo $this->doctype(); ?>
<html xmlns="http://www.w3.org/1999开发者_如何学JAVA/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php $this->headTitle()->append('Site Title'); ?>
<?php echo $this->headTitle(); ?>
</head>
<body>
<div class="dp100">
<?php
echo $this->layout()->content;
?>
</div>
</body>
</html>

Still, I do not see the expected doctype declaration in my final HTML page.


Duh! I was checking my source code in Firebug which actually hid the DOCTYPE declaration because it was not echoed first in the HTML document. I have echoed a jquery include statement before echoing the doctype.

Found the solution by checking the actual source code in Firefox.

0

精彩评论

暂无评论...
验证码 换一张
取 消