Menu

#239 Usage of info.phtml

open
nobody
None
2019-04-09
2019-04-09
Anonymous
No

Originally created by: Stevie-Ray

Hi Magefan,

First of all thanks for your free module.

I'm having some trouble with the implementation of magefan/module-blog/view/frontend/templates/post/info.phtml. I've used this module for different project and notice that in almost every situation I want to split the info.phtml file, it contains: post-posed-date, post-comments, post-categories and post-author and is implemented with: <?php echo $this->getInfoHtml() ?> it just doesn't work very well with custom designs.

Suggestion:
What I did is let the Info class extend the post View like so: class Info extends \Magefan\Blog\Block\Post\View in that way I'm able to use this class in layout.xml:

<block class="Magefan\Blog\Block\Post\Info" name="blog.post.category" template="Magefan_Blog::post/category.phtml" />

<block class="Magefan\Blog\Block\Post\Info" name="blog.post.author" template="Magefan_Blog::post/author.phtml" />

It makes it very easy to create custom .phtml templates and position them with xml. Let me know what you guys think about this workaround, and maybe you can include something like this in you next release.

Thanks in advance,

Stevie

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.