joomla 2.5 中的视图和任务有什么区别,joomla 2.5 中的 url 结构是什么? [英] what is difference between view and task in joomla 2.5 and what is url structure in joomla 2.5?

查看:17
本文介绍了joomla 2.5 中的视图和任务有什么区别,joomla 2.5 中的 url 结构是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 joomla2.5 的新手,我正在开发一个表单组件,它可以简单地从用户那里获取数据并保存到数据库,但我对表单重定向感到困惑.

请告诉我这是什么意思:

index.php?option=com_users&task=registration.register

请给我定义task=registration.register",也包括点.

index.php?option=com_test2&view=test2

请定义视图和任务之间的区别以及什么是 joomla2.5 url 结构基础.

谢谢你的问候

解决方案

在 Joomla 中,

View 代表组件视图.一个组件有多个视图,比如 Joomla 默认组件 com_users 有不同的视图

注册、简介等

Task 表示控制器文件中的函数.

喜欢这里

index.php?option=com_users&task=registration.register

registration 控制器有一个带有 register

的函数名

在视图中

index.php?option=com_test2&view=test2

表示组件 com_test2 有一个带有 test2

的视图文件夹

在其他方式中,您可以使用隐藏字段访问控制器内的 register 功能.如果你有一个表单要提交,那么就像这样.

<input type="hidden" name="controller" value="registration"/><input type="hidden" name="task" value="register"/>

您可以从此处

希望它有所帮助..

I'm new to joomla2.5 and i'm working on a form component that will simple get data from user and save to database but i have confusion regarding form redirect.

please tell me what means of this:

index.php?option=com_users&task=registration.register

please define me "task=registration.register" including dot also.

index.php?option=com_test2&view=test2

please define different between view and task and what is joomla2.5 url structure fundamentals.

Thanks with regards

解决方案

In Joomla,

View stands for component views. A component have multiple views like Joomla default component com_users have different views

registration,profile etc

Task means the function inside your controller file.

like here

index.php?option=com_users&task=registration.register

registration controller have a function name with register

In the view

index.php?option=com_test2&view=test2

means component com_test2 have a view folder with test2

In other way you can access the register function inside your controller is by using hidden fields. If you have a form to submit then something like.

<input type="hidden" name="option" value="com_users"/>
<input type="hidden" name="controller" value="registration"/>
<input type="hidden" name="task" value="register"/>

You will get more details about Joomla component structure from here

Hope its helps..

这篇关于joomla 2.5 中的视图和任务有什么区别,joomla 2.5 中的 url 结构是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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