Joomla:将表单字段从模块发布到组件
我是 Joomla 开发的初学者。我开发了一个评级模块,如下所示。
我已设法从数据库中获取评分,但我不知道如何插入数据库当用户单击投票按钮时。
我的模块中有一个表单,其中包含四个下拉框和一个提交按钮(投票)。现在我计划开发一个组件来处理这个表单数据。我应该如何开发我的组件来处理这个问题?我的模块中的表单操作应该是什么?
任何帮助表示赞赏。提前致谢。
I am a beginner to Joomla development. I have developed a rating module which looks as below.
I have managed to get the ratings from my database, but I do not know how to insert into the database when user clicks the vote button.
I have a form in my module which contains the four drop down boxes and a submit button (Vote). Now I am planning to develop a component in order to process this form data. How should I develop my component to process this? And what should be the form action in my module?
Any help is appreciated. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建组件
http://docs.joomla.org/Developing_a_Model-View-Controller_Component__-_Part_1
创建模块
http://docs.joomla.org/Creating_a_simple_module
您必须使用 JRoute 指定模块的操作
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component
查看组件代码示例
,因此您必须创建控制器和特殊组件处理数据的任务方法
如果您根本不需要组件,您可以将逻辑放入模块中
通过这种方式,模块应该对当前页面有表单操作并处理类似的逻辑
Create component
http://docs.joomla.org/Developing_a_Model-View-Controller_Component_-_Part_1
Create module
http://docs.joomla.org/Creating_a_simple_module
you must specify action of your module with JRoute
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component
look at component code example
so you must create controller and special task method for processing data
If you don't need component at all you can put logic in your module
In this way module should have form action to current page and process logic something like