1

I have a block class called Fekete_Newsletter2Go_Block_Form.

<?php
class Fekete_Newsletter2Go_Block_Form extends Mage_Core_Block_Template
{
    private $n2g;
    private $session;
    private $customer;

    public function __construct()
    {
        if ( !isset($this->n2g) ) {
            $this->n2g = Mage::Helper("fekete_newsletter2go");
        }
        if ( !isset($this->session) ) {
            $this->session = Mage::getSingleton('customer/session');
        }
        if ( !isset($this->customer) ) {
            $this->customer = $this->session->getCustomer();
        }
    }

    public function getEmail()
    {
        return $this->customer->getEmail();
    }
}

This is the config entry:

<global>
  ...
    <blocks>
        <fekete_newsletter2go>
            <class>Fekete_Newsletter2Go_Block</class>
        </fekete_newsletter2go>
    </blocks>

How can I use it on a CMS page?

I tried it like this:

{{block type="fekete_newsletter2go/form" template="fekete/Newsletter2Go/subscribe.phtml"}}

But then nothing is rendered, it only works with core/template.

  • Can you post your block class file here? – Sukumar Gorai Aug 6 '18 at 9:33
  • ok, I posted it. – Black Aug 6 '18 at 9:37
  • Code looks fine. Can you clear your cache and try again. – Sukumar Gorai Aug 6 '18 at 9:44
2

You probably need to add your block type to the allowed blocks under System > Permissions > Blocks.

One of the recent M1 SUPEE patches added this feature for security reasons, requiring blocks included in CMS content to be white-listed.

0

Please try below code . I have just replace code Newsletter2Go To newsletter2Go.

{{block type="fekete_newsletter2go/form" template="fekete/newsletter2Go/subscribe.phtml"}}

I hope it will work for you

  • The template is not the problem... – Black Aug 6 '18 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.