如何覆盖Magento中另一个文件模块的布局XML文件



我有一个模块Askit,该模块在以下目录

/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页面的元数据。

当我提到这个问题时

http://example.com/questions/

我想从我的主题local.xml文件

设置上面页面的元

这是布局XML目录URL -

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

我在我的主题布局locuer.xml文件中写了以下代码,但它没有更新此页面的元数据 -

<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>

主要是从local.xml工作,如上所述。但是,如果不超过您可以通过控制器添加元信息。

致电$this->loadLayout(); and $this->loadLayout();

后,将以下代码添加到控制器(QuestionController)的indexAction
$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'));
}

相关内容

最新更新