Joomla 模型视图控制器 (MVC) 如何工作?
我是 Joomla 的新手,我想知道 Joomla 控制器如何将数据传递给模型,模型传递给控制器以及控制器传递给视图。虽然这可能是一个愚蠢的问题,但我确实试图找到答案。我希望我能从 stackoverflow 大家庭得到一些帮助。
I am new to Joomla, I want to know how the Joomla controller passes data to the model, model to controller and controller to view. Although this might be a silly question, I really tried to find the answer. I hope I can get some help from the stackoverflow family.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
控制器获取 url 中的视图变量,并使用这些变量确定需要使用哪个视图。然后它设置要使用的视图。然后视图调用模型来获取所需的数据,然后将其传递给要显示的 tmpl。
下面是一个简单的设置,说明了这一切是如何协同工作的:
Components/com_test/controller.php
Components/com_test/views/someview/view.html.php
Components/com_test/models/someview.php
Components/com_test/views/someview/tmpl /someviewtmpl.php
The controller picks up the view variable in the url and using these determines which view needs to be used. It then sets the view to be used. The view then calls the model to fetch the data it requires and then passes this to the tmpl to be displayed.
Below is a simple setup of how this all works together:
components/com_test/controller.php
components/com_test/views/someview/view.html.php
components/com_test/models/someview.php
components/com_test/views/someview/tmpl/someviewtmpl.php
查看此站点,了解有关如何使用 Joomla 的 MVC 制作组件和模块的详细教程。希望它有帮助
https://docs.joomla.org/Developing_a_MVC_Component
check out this site for detailed tutorial on how to make components and modules using Joomla's MVC. Hope it helps
https://docs.joomla.org/Developing_a_MVC_Component
另请参阅官方 joomla 文档,了解有关如何使用 Joomla 的 MVC 制作组件和模块的详细教程。希望有帮助
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/1.5/Introduction
Also refer official joomla doc for detailed tutorial on how to make components and modules using Joomla's MVC. Hope it helps
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/1.5/Introduction