2011-11-21 73 views
0

我正在使用zend。當我使用下面的代碼時,如何使用zend將close樣式表添加到樣式表中?

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

這個輸出像下面out out元素。

<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的?請在此建議。

+0

您需要將doctype設置爲xhtml – vascowhite

+0

@vascowhite我給了<!DOCTYPE html PUBLIC「 - // W3C // DTD XHTML 1.0 Transitional // EN」「http://www.w3.org/T R/xhtml1/DTD/xhtml1-transitional.dtd「>在我的網頁。 – mymotherland

回答

4

您需要使用指定DOCTYPE的doctype helper

,如果你願意,你可以做到這一點在你的引導: -

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" 
+0

謝謝,非常有幫助。 – mymotherland

相關問題