简体   繁体   English

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

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

I have passes value from controller like 我已经从控制器传递了值

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

i am trying to get value of catstatus on abc.phtml page by 我正在尝试通过abc.phtml页面获取catstatus

$this->getData('catstatus');

i am able to get this on the phtml page 我能够在phtml页面上得到它

but I am not getting blankstring when get this value on my indexcontroller.php 但是当我在indexcontroller.php上获取此值时,我没有得到blankstring

Please suggest a possible solution. 请提出可能的解决方案。

Please refer below code 请参考下面的代码

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