2016-12-01 108 views
2

我有在以下目錄模塊Askit如何覆蓋另一個文件模塊的佈局XML文件中的Magento

/var/www/html/app/design/frontend/base/default/template/tm/askit/ 

form.phtml頁面包含在目錄下面

/var/www/html/app/design/frontend/base/default/template/tm/askit/question/form.phtml 

我想更新其佈局xml來設置其phtml頁面的元數據。

正如我所說this question

http://example.com/questions/

我想從我的主題local.xml文件,

這裏設置上述頁面元就是佈局xml目錄網址 -

/var/www/html/app/design/frontend/argento/mall/layout 

我已經在我的主題佈局local.xml文件中編寫了下面的代碼,但是它並沒有爲此頁面更新meta -

<askit_question_index> 
    <reference name="head"> 
     <action method="setTitle"><value>Ask an Expert and Get Answers - </value></action> 
     <action method="setDescription"><value>Ask a question and get an answer to your question from a Expert related to your purchased product </value></action> 
    </reference> 
</askit_question_index> 
+0

確保您local.xml中成功解析之後。檢查var/log。 –

+0

local.xml正常工作。我已經更新Meta的其他頁面使用相同的XML。只有有該頁面的問題。 – John

回答

0

大多數情況下,它應該是根據上述提到的代碼從local.xml中工作的。但是,如果不是,你可以通過控制器添加元信息。

添加下面的代碼到你的控制器(QuestionController)的indexAction調用$this->loadLayout(); and $this->loadLayout();

$headBlock = $this->getLayout()->getBlock('head'); 
if ($headBlock){ 
    $headBlock->setTitle($this->__('Ask an Expert and Get Answers')); 
    $headBlock->setDescription($this->__('Ask a question and get an answer to your question from a Expert related to your purchased product')); 
    $headBlock->setKeywords($this->__('Meta keywords here')); 
} 
+0

我需要檢查網址來設置元? – John

+0

將此代碼添加到您的問題控制器中 –