如何使用zend追加带有close元素的样式表?

时间:2011-11-21 05:35:35

标签: php zend-framework xhtml

我正在使用zend。当我使用下面的代码时,

<?=  $this->headLink()
            ->appendStylesheet(BASE_URL . 'css/css.css');
 ?>

此输出如下,但没有关闭元素。

<link href="/ecomos3/css/css.css" media="screen" rel="stylesheet" type="text/css" >

所以这个在w3验证失败并得到“end tag for "link" omitted, but OMITTAG NO was specified

我希望链接标记应该是

<link href="/ecomos3/css/css.css" media="screen" rel="stylesheet" type="text/css" />

我怎么能在zend做到这一点?请提出建议。

1 个答案:

答案 0 :(得分:4)

您需要使用doctype helper

指定docType

如果您愿意,可以在引导程序中执行: -

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initDoctype()
    {
        $this->bootstrap('view');
        $view = $this->getResource('view');
        $view->doctype('XHTML1_STRICT');
    }
}

或者将此行添加到config.ini文件中: -

resources.view.doctype = "XHTML1_STRICT"