PyroCMS:模块、插件还是小部件?

发布于 2024-11-17 22:53:35 字数 239 浏览 2 评论 0原文

我是 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

送你一个梦 2024-11-24 22:53:35

您需要能够通过控制面板管理产品吗?那么你至少需要从创建一个模块开始。来自词汇表

...所有自定义代码
需要界面和额外的 CSS 或
JavaScript 文件应该写成
一个模块,而不是一个小部件。

从那里开始,界限变得有点模糊:

与小部件类似,插件是独立的逻辑,可以
嵌入内容或主题
布局,但不是有一个
这些图形元素被处理
完全通过标签语法。

小部件 - 可安装的小块独立逻辑和 HTML
在管理界面中。他们可以是
分配给特定的小部件区域和
直观地排序。

如果我没记错的话,插件和小部件都接受参数。主要区别在于小部件被分配到特定的模板区域,而插件可以使用 {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:

...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.

迷爱 2024-11-24 22:53:35

仔细阅读您的需求,答案是您需要一个模块。
看,我也是 PyroCMS 的初学者,但使用 2 个月后,我已经构建了模块、插件和小部件,我可以告诉您,您的代码的重要性(显示产品列表) ,搜索功能,也许上传图像?)适当的是一个模块

您将拥有与 widgetplugin 相同的功能,但模块就是全部:使用外部库,包括 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 a module.

You will have the same functionality that gives you a widget or a plugin but a module is the whole thing: use external libraries, includes js/css in the HEAD, add admin functionality, build modular plugins, use the settings table and the Settings 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文