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.

asked Jan 27, 2016 at 12:43
9
  • magento version? you are working on Commented Jan 27, 2016 at 12:46
  • version 1.8.0.0 Commented Jan 27, 2016 at 12:57
  • any error in error log? Commented Jan 27, 2016 at 13:01
  • did you check with {{block type="core/template" name="slider_slider" template="company/slider/slider.phtml"}} Commented 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. Commented 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
answered Jan 27, 2016 at 12:49
4
  • I added company/slider_slider but no difference. Commented Jan 27, 2016 at 12:58
  • you mean company_slider/slider right? Commented Jan 27, 2016 at 13:12
  • yes, my mistake. I added company_slider/slider Commented 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) Commented Jan 27, 2016 at 13:47

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.