2012-09-18 30 views
0

Zend Framework的配置文件的格式,我們可以像下面編程方式指定meta標籤:爲headmeta

$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=utf-8'); 

如何上面可以通過配置文件來完成?我試過

resources.view.headMeta.contentType = "text/html; charset=utf-8" 

但這不起作用。

回答

0

我發現,我們可以在配置文件中添加如下條目:

resources.view.contentType = "text/html; charset=utf-8" 
resources.view.language = "en" 

然後使用普通的事:

protected function _initView() { 
    $options = $this->getOptions(); 
    if(isset($options['resources']['view']['contentType'])) { 
      $view->headMeta()->appendHttpEquiv('Content-Type', 
       $options['resources']['view']['contentType'] 
      ); 
    } 

    if(isset($options['resources']['view']['language'])) { 
     $view->headMeta()->appendHttpEquiv('language', 
       $options['resources']['view']['language'] 
     ); 
    } 
    ...contd. 
0

看到這個page - 它描述了資源的配置選項Zend_Application引入的插件。 Kidna埋在文檔中。

contentType價值例如應該也不需要你編碼任何在你的引導的方法_initView

相關問題