I want to pass value from block but I am unable to get the desire results.
Something going wrong which I don't know why.
I try the code "block type="multibanners/multibanners" name="multibanners" category_id="5" alias="multibanners"
in xml file.
To get results I used echo $this->getCategoryId()
and getData('category_id')
.
I search but all time the same code.
Can anyone help me whats wrong with the code.
Thanks.
You can set your variables like this:
<block type="multibanners/multibanners" name="multibanners" alias="multibanners">
<action method="setData"><name>category_id</name><value>5</value></action>
</block>
and retreive it like this:
$this->getCategoryId();
Mage_Core_Block_Template::assign()
is made for that
Example of use in Mage_Page_Block_Html_Breadcrumbs::_toHtml()
+ direct call of $crumbs
var in the breadcrumbs.phtml
template file
Or in your controller, after
$this->loadLayout();
but before
$this->renderLayout();
use this code:
$this->getLayout()->getBlock('multibanners')->setCategoryId(42);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With