当它们被传递到我们的网站时,我试图从 Joomla 中的 URL 字符串中提取值.一个例子是:
?source=SEARCH%20&utm_source=google&utm_medium=cpc&utm_term=&utm_content={creative}&utm_campaign=&cpao=111&cpca=&cpag=&kw=
因此,我希望抓取 VAR=utm_source、抓取 utm_medium 等.
我想在整个网站上携带这些值,并至少保留到访问者点击表单提交,这样这些值将与表单一起传递以跟踪这些区域以查看它们来自哪里,使用了哪些关键字等.
任何帮助将不胜感激.
要获取 URL(和 POST)值,您可以使用 JRequest 或 JInput.JRequest 已被 Joomla 3.0 弃用,因此最好使用 JInput :-)JRequest:http://docs.joomla.org/Retrieving_and_Filtering_GET_and_POST_requests_with_JRequest::getVarJInput:http://docs.joomla.org/Retrieving_request_data_using_JInput
Joomla 还可以将值存储到用户会话中.如果您想在多个页面上跟踪某些内容,或者想要保留用户所做的某些设置(例如订购),这将非常方便.这些被称为 UserStates,文档在这里:http://docs.joomla.org/How_to_use_user_state_variables>
I am trying to pull values from a URL string in Joomla when they are passed into our site. an example is:
?source=SEARCH%20&utm_source=google&utm_medium=cpc&utm_term=&utm_content={creative}&utm_campaign=&cpao=111&cpca=&cpag=&kw=
so out of this I will want the VAR=utm_source grabbed, utm_medium grabbed etc.
I want to carry these values across the sites and held at least until the visitor hits submit on a form so these values will be passed with the form to track these areas to see where they came from, what keywords were used etc.
any help will be appreciated.
To get URL (and POST) values you use either JRequest or JInput. JRequest is depreceated with Joomla 3.0 so better use JInput :-) JRequest: http://docs.joomla.org/Retrieving_and_Filtering_GET_and_POST_requests_with_JRequest::getVar JInput: http://docs.joomla.org/Retrieving_request_data_using_JInput
Joomla also has the possibility to store values into the user session. This is handy if you want to track something over multiple pages, or want to preserver some settings (like ordering) a user made. These are called UserStates and the doc is here: http://docs.joomla.org/How_to_use_user_state_variables
这篇关于Joomla 获取 URL 中传递的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!