繁体   English   中英

如何通过magento中的Block获取控制器中传递的参数的值?

[英]How to get value of passed parameter in controller by Block in magento?

我已经从控制器传递了值

{{block type="test/test" name="test123" catstatus="xyz" template="storelocator/abc.phtml" }}

我正在尝试通过abc.phtml页面获取catstatus

$this->getData('catstatus');

我能够在phtml页面上得到它

但是当我在indexcontroller.php上获取此值时,我没有得到blankstring

请提出可能的解决方案。

请参考下面的代码

//Loading current layout
$this->loadLayout();
//Creating a new block
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'test_block_name',
array('template' => 'page/html/testblock.phtml')
);

$this->getLayout()->getBlock('content')->append($block);

//Now showing it with rendering of layout
$this->renderLayout();

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM