Pyrocms模块或小部件或插件 [英] Pyrocms module or widget or plugin

查看:167
本文介绍了Pyrocms模块或小部件或插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我疯狂!我想在网站首页上添加一个简单的联系表单。我不能工作,如果我需要建立一个模块,小部件或插件。他们似乎都不是很正确!
模块似乎只作为独立页面工作,例如现有的联系人模块。窗口小部件似乎只显示数据(从数据库或某种类型的feed,例如twitter),一个插件似乎就像一个库类。
我需要的是一个模块。我需要一个控制器(显示正确的视图和处理数据从表单和视图取决于表单是否已提交
我的问题是,我无法解决如何包括一个模块作为一个

This is driving me mad! I want to include a simple contact form on a sites homepage. I can't work out if I need to build a module, widget or plugin. None of them seem to be quite right! Modules only seem to work as standalone pages eg the existing contact module. Widgets only seem to display data (got from db or some kind of feed eg twitter) and a plugin seems to be just like a library class. What I need is most like a module. I need a controller (to display the correct view and process the data from the form and views dependent on whether the form has been submitted or not. My problem is I can't work out how to include a module as a section of a page (just like you would a widget) instead of a page in it's own right.

推荐答案

任何一个页面都可以工作。

Any of those would work.

模块是一个MVC三元组,可以与URL交互,显示视图,有自己的模型,帮助,配置等。模块是完整的肉和两个veg。

A module is a MVC triad that can interact with a URL, show views, have its own models, helpers, config, etc. A module is the full meat and two-veg.

一个Widget只是一个自包含的智能部分,这意味着它需要从控制面板的几个选项为每个实例和吐出一个块的HTML。

A Widget is just a self-contained intelligent partial. That means it takes a few options from the Control Panel for each instance and spits out a chunk of HTML.

插件只是一个标签,这个标签用于模板,页面,新闻等任何东西,在类中有各种方法,每个方法都会有不同的标签。

A Plugin is just a tag. This tag is used in the template, pages, news, whatever and spits out a chunk of HTML too. A Plugin can have various methods in the class, each method will be a different tag.

我实际上已经创建了所有这些类型的联系人表单, on for PyroCMS v1.1是一个模块化插件。这意味着有模块的视图,模型等,但我们可以跳过控制器,只是做一个插件这样。

I have actually made contact forms as all of these types of addon, but the one I have settled on for PyroCMS v1.1 is a modular plugin. This means there are views, models, etc for the module but we can skip the controller and just make a plugin like so.

这个插件匹配标签: / p>

That plugin matches up to the tag:

{pyro:contact:form}

这是因为它在联系人模块中,方法是form。看到? :)

That is because it is in the contact module and the method is form. See? :)

这篇关于Pyrocms模块或小部件或插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆