PyroCMS:模块、插件还是小部件?
我是 PyroCMS 的新手,正在努力弄清楚如何实现某些东西。
假设我有一个要展示的产品列表。列表中的每件商品都会显示产品照片、描述及其价格。该产品列表可以用在主页(例如显示一些产品)、搜索结果(例如 SERP)或浏览页面等中。
我应该能够创建一个包含所有产品的“东西”该列表需要标记,并且能够接受参数(例如,仅获取在主页上显示的前 5 个项目)。问题是我不知道这个“东西”应该是什么:模块、插件还是小部件?
建议?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要能够通过控制面板管理产品吗?那么你至少需要从创建一个模块开始。来自词汇表:
从那里开始,界限变得有点模糊:
如果我没记错的话,插件和小部件都接受参数。主要区别在于小部件被分配到特定的模板区域,而插件可以使用 {tags} 嵌入到您想要的任何内容中。由于这只会嵌入到某些页面的内容中,因此我会使用一个插件。
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:
From there, the line gets a bit blurry:
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.
仔细阅读您的需求,答案是您需要一个模块。
看,我也是 PyroCMS 的初学者,但使用 2 个月后,我已经构建了模块、插件和小部件,我可以告诉您,您的代码的重要性(显示产品列表) ,搜索功能,也许上传图像?)适当的是一个
模块
。您将拥有与
widget
或plugin
相同的功能,但模块就是全部:使用外部库,包括js/css
> 在HEAD
中,添加管理功能,构建模块化插件,使用后端的settings
表和Settings
选项卡轻松设置和访问来自整个应用程序的变量。此外,如果这是您第一次使用
PyroCMS
,模块将使您对整个 CMS 有更广泛的了解。Reading you requirements carefully the answer is that you need a module.
Look, I am a beginner in
PyroCMS
too, but after 2 months using it I have build modules, plugins, and widgets and I can tell you that for the importance that your code have (show listing of products, search functionality, maybe upload images?) the appropriate is amodule
.You will have the same functionality that gives you a
widget
or aplugin
but a module is the whole thing: use external libraries, includesjs/css
in theHEAD
, add admin functionality, build modular plugins, use thesettings
table and theSettings
tab in the backend to easily set and access variables from the entire application.Besides if it is your first experience using
PyroCMS
a module will give you a more wider view of the entire CMS.