2016-12-01 113 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

将此代码添加到您的问题控制器中 –