I've build my first Magento Widget. Now in the /Block/MyBlock.php I would like to call a *.phtml template and hand over some variables, given in the widget.
I managed to call my template within the /Block/MyBlock.php with
protected function _toHtml() {
return Mage::getSingleton('core/layout')->createBlock('core/template')->setTemplate('webmasterei/Header.phtml')->toHtml();
$brand_header_logo = $this->getData('brand_header_logo');
$this->setData('logo',$brand_header_logo);
}
Now I want to echo $brand_header_logo
within the Header.phtml. How do I do that? Is the template actually in the right place or should I make that with this?
<template>
<required>1</required>
<visible>0</visible>
<label>Template</label>
<type>select</type>
<value>path/to/template/template.phtml</value>
</template>
How do I hand over the variables from the MyBlock.php in this case?
I tried now in the /template/Module/template.phtml
<?php echo $this->logo ?>
As layed out before but that doesn't work. I think I'm missing the connection here.
You can pass the variable to your template with:
Then in your template file: