1

I have a phtml file mw/news/slider.phtml.

I would like to use this file at cms page.

So how can i do this by using widget ?

5

You can use the following code in the content area of the CMS page:

{{block type="core/template" template="mw/news/slider.phtml"}}

If needed you can replace 'core/template' with another custom block type.

You can't use a custom .phtml template when adding a widget, so inserting the block directly is the right way to do it.

  • yep, but i want use widget, your method? – Trong Tran Xuan Oct 13 '15 at 1:24
  • Are you building a custom extension? – Milan Simek Oct 13 '15 at 1:25
  • Here is a tutorial on creating a widget: code.tutsplus.com/tutorials/… You'll need to let it extend Mage_Core_Block_Template instead of Mage_Core_Block_Abstract, and set the template to the template file you want to use. – Milan Simek Oct 13 '15 at 1:28
  • I'd like to show you but I can't explain it better than the blog post. The easiest solution is to just use the block like in my answer. – Milan Simek Oct 13 '15 at 3:14
  • Hi Trong Tran Xuan, please accept my answer if it solves you problem. Thanks! – Milan Simek Oct 18 '15 at 17:50

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.