I'm new to PyroCMS and struggling to figure out how to implement something.
Say I have a list of products I want to display. Each item in the list shows a photo of the product, a description, and its price. This listing of products can be used on the homepage (e.g. displaying a few products), or in the search results (e.g. a SERP), or a browse page, etc.
I should be able to create one "thing" that has all the markup needed for this listing, along with it being able to accept parameters (e.g. only get the top 5 items to display on the homepage). Problem is I don't know what this "thing" should be: module, plugin, or widget?
Suggestions?
Do you need to be able to manage the products via control panel? Then you at least need to start by creating a module. From the glossary:
...All custom code that requires an interface and extra CSS or JavaScript files should be written as a Module, not a Widget.
From there, the line gets a bit blurry:
Similar to Widgets, Plugins are self-contained logic that can be embedded into content or theme layouts, but instead of having a graphical element these are handled entirely through Tag syntax.
Widgets - Small chunks of self-contained logic and HTML that can be installed in the admin interface. They can be assigned to specific Widget Areas and ordered visually.
If I remember correctly, both plugins and widgets accept parameters. The main difference is that widgets get assigned to specific template areas, while plugins can be embedded in content anywhere you want with {tags}. Since this is going to be embedded in the content of only certain pages, I'd go with a plugin.