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.

9
  • magento version? you are working on Jan 27, 2016 at 12:46
  • version 1.8.0.0
    – JohnyFree
    Jan 27, 2016 at 12:57
  • any error in error log? Jan 27, 2016 at 13:01
  • did you check with {{block type="core/template" name="slider_slider" template="company/slider/slider.phtml"}} Jan 27, 2016 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, 2016 at 13:17

1 Answer 1

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
4
  • I added company/slider_slider but no difference.
    – JohnyFree
    Jan 27, 2016 at 12:58
  • you mean company_slider/slider right? Jan 27, 2016 at 13:12
  • yes, my mistake. I added company_slider/slider
    – JohnyFree
    Jan 27, 2016 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, 2016 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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