Page Type or Layout or Plugin ???
Created 6 years ago by kiltedup

Hi, Seeking opinion(s) on the the following.

I have created a module that I will be using on 4 sites.

It is for 'additional content' and adds streams to hold such things as testimonials, team member bios for 'meet the team' style page etc. (not using repeaters/grids for a variety of reasons in case that is an answer !!!)

All working re module - no issues there but I need to then output this content when the user builds up their pages.

For example - there needs to be a testimonials page and I want that page to automatically include the entries from the testimonials stream.

I have played around with ALL of the following and they all work - so my question is which one would be considered the "correct" way to do it in Pyro.

Page Type: Create a 'testimonials' page type and add the code to display the testimonials in the page type layout.

Layout: Add a layout in the theme and add the code there so the user would just create a default page but choose 'testimonials' as the layout to use

Plugin: Create a plugin and have that included in whatever page is created to display them i.e. {{ testimonials()|raw }} or similar .....

Any thoughts? Is there a correct way or is it a case of whatever works and whatever one I like best ????


ryanthompson  —  6 years ago

I would look into something like what the Comments module does. It uses a combination of plugins for quick access when you want to do 100% custom implementation (which may not be needed with entries plugin function - don't make more work for yourself). And it also includes partials you can drop in and instantly get setup and running (which you can then customize as needed if you want).

kiltedup  —  6 years ago

Thanks - got some tips in there. Trying to avoid the Page Type route as not being able to change once created is an issue. Using a mixture of layouts and partials along side the grid field type.