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

des*_*est 5 magento

这在我的.phtml文件中不起作用.

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

Jos*_*ton 7

我相信你会想要将代码放入你的控制器,而不是你的视图文件.