你好,
我正在尝试为我的自定义模块创建一个路由器。
我想通过 url/hotsale 访问索引控制器的 hotsale 操作。因此,我在模块的 config.xml 中创建了以下路由器 xml。
<hotsale>
<use>standard</use>
<args>
<module>Moon_Products</module>
<frontName>hotsale</frontName>
</args>
</hotsale>
当我访问 url/hotsale 时,它会转到索引控制器的索引操作。如何使其执行热销操作?
我尝试添加热销,但没有奏效。
我接受了 Alan Storm 的建议,并以以下代码结束。
public function indexAction()
{
if($this->getRequest()->getRouteName() == 'hotsale'){
$this->loadLayout();
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'my_block_name_here',
array('template' => 'moon/hotsale.phtml')
);
$this->getLayout()->getBlock('root')->setTemplate('page/product-without-rightbar.phtml');
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}
}