1

I have problem with inserting custom block/template into cms page editor. If I put the below code to header.phtml it works fine and it displays content inside home page:

echo $this->getLayout()->createBlock('company_slider/slider')->setTemplate('company/slider/slider.phtml')->toHtml();

But if I try to insert this into cms page it won't display anything:

{{block type="company_slider/slider" name="slider_slider" template="company/slider/slider.phtml"}}

I have these lines in extension config file:

<global>
      <blocks>
          <company_slider>
              <class>Company_Slider_Block</class>
          </company_slider>    
      </blocks>                                      
</global> 

Am I missing anything? I guess paths are correct because it works if I insert block directly to phtml file as shown above.

  • magento version? you are working on – Qaisar Satti Jan 27 '16 at 12:46
  • version 1.8.0.0 – JohnyFree Jan 27 '16 at 12:57
  • any error in error log? – Qaisar Satti Jan 27 '16 at 13:01
  • did you check with {{block type="core/template" name="slider_slider" template="company/slider/slider.phtml"}} – Qaisar Satti Jan 27 '16 at 13:05
  • This displays template, but block company_slider/slider is not loaded, I need also company_slider/slider to be loaded. – JohnyFree Jan 27 '16 at 13:17
2

have you added the block in white list?

  • Login to admin panel then go to System > Permissions > Blocks
  • Add the block - Enter company_slider/slider
  • in the field Set Allowed to Yes
  • I added company/slider_slider but no difference. – JohnyFree Jan 27 '16 at 12:58
  • you mean company_slider/slider right? – Patrick Knudsen Jan 27 '16 at 13:12
  • yes, my mistake. I added company_slider/slider – JohnyFree Jan 27 '16 at 13:13
  • I just realized that actually solved the problem, I am not sure why it didn't work immediately when I added block into permissions, but it is indeed that what it solved the problem. Thank you! I will whitelist my block inside installation script (instructions here) – JohnyFree Jan 27 '16 at 13:47

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.