2

like this

<block class="Magefan\Blog\Block\Post\PostList\Item" name="blog.posts.list.item" template="post/list/item.phtml">
      <block class="Magefan\Blog\Block\Post\Info" name="blog.post.info" template="post/info.phtml" />
         <action method="setPostInfoBlockName">
                    <argument name="name" xsi:type="string">blog.post.info</argument>
         </action>
</block>
2

Create a layout file in this path:

Magefan/Blog/view/base/layout/magefan_blog_cms_postlist.xml

And like any other layout define all your blocks and nested blocks (as you have posted in your question).

Note: your template files should be in view/base

And then in CMS page or block use it like:

{{layout handle="magefan_blog_cms_postlist"}}

There is no way to define nested blocks in CMS directly. You need to use your custom layout and layout handle.

| improve this answer | |
  • Thanks ! It works for me. Another problem is whether it is feasible to put the layout file into the custom theme folder – tuyuan ho Aug 20 '18 at 13:33
  • Yes you can, actually base is used for both frontend and backend. You can put into theme as well like: Magefan_Blog/layout and similar for template as well. – Kumar M Aug 20 '18 at 13:37
1

You can try

{{block class="Magefan\Blog\Block\Post\PostList\Item" template="Magefan_Blog::post/list/item.phtml"}} 

Hope it helps !

| improve this answer | |
  • I try and it doesn't work – tuyuan ho Aug 20 '18 at 9:14
  • You can put it on cms page then save and clear cache to see result – Magetop E-commerce Aug 21 '18 at 2:27
  • Any new result ? – Magetop E-commerce Aug 21 '18 at 7:17

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.