I want to execute some custom PHP code in a static CMS block. I want to do this by having a block of type core/template loading a template containing the PHP code. I have created the block and can do a "Hello, world" echo, however I can't access $this.
The code I use in the static CMS block to include the template with the PHP code is: {{block type="core/template" template="module/template.phtml"}}
. core/template has been whitelisted.
Anyone has a clue why I can't use $this? Thanks in advance.
EDIT: This is the template content.
<?php
$_product = Mage::registry('current_product')->getName();
$this->helper('yotpo')->showWidget($this, $_product);
?>
<div id="yotpo-placeholder"></div>
EDIT: I ended up fixing this by declaring the block in my themes' local.xml, instead of using a static CMS block.
$this
in templates. It is actually used everywhere in the core.$this
references the block instance, in your caseMage_Core_Block_Template
. Please add the template content so we can see what's wrong.