如何在Magento模块中使用php设置元标记?

问题描述:

这不适用于我的.phtml文件。如何在Magento模块中使用php设置元标记?

$head = $this->getLayout()->getBlock('head'); 
$head->setTitle("title blah"); 
$head->setDescription("description goes here"); 
$head->setKeywords("apples bananas coconuts"); 

我相信你会想要把代码放到你的控制器中,而不是你的视图文件。