[英]Passing value to Joomla Module from another URL
I'm newbie to Joomla module development, and would like to implement a custom module for Joomla CMS. 我是Joomla模块开发的新手,并且想为Joomla CMS实现自定义模块。
I need to display the sales history of the logged in user. 我需要显示已登录用户的销售历史。 For example, a user with [username] = "US001" logged in successfully, and go to view what sales orders have done by him.
例如,一个[username] =“ US001”的用户成功登录,然后查看他的销售订单。 And the module display the data recordset in table format by passing the "US001" as username parameter to my database and retrieve the data.
然后,该模块通过将“ US001”作为用户名参数传递给我的数据库,并以表格式显示数据记录集并检索数据。
You want to access the user object. 您要访问用户对象。 Joomla already has most of what you need built in, you just pull up the current user and you have the info.
Joomla已经内置了您所需的大部分功能,您只需拉动当前用户即可获得信息。
To start with, you will need to get the current user info - 首先,您需要获取当前的用户信息-
`$user =& JFactory::getUser();`
if ($user->guest)
will tell you if the user is logged in, $user->name
will give you the username if ($user->guest)
会告诉您用户是否已登录,则$user->name
将为您提供用户名 User object tutorial - http://docs.joomla.org/Accessing_the_current_user_object Parameters - http://docs.joomla.org/Standard_parameter_types Form fields - http://docs.joomla.org/Form_field 用户对象教程-http: //docs.joomla.org/Accessing_the_current_user_object参数-http: //docs.joomla.org/Standard_parameter_types表单字段-http://docs.joomla.org/Form_field
Lastly, it sounds like you would be better served creating a component instead of a module, unless you plan to display the database info you are pulling as part of another page that will be displaying the main content. 最后,听起来您最好还是创建一个组件而不是一个模块,除非您打算将要提取的数据库信息显示为另一个页面的一部分,该页面将显示主要内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.