Joomla getting Variables passed in URL

那年仲夏 提交于 2021-02-16 19:06:29

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/16023865/joomla-getting-variables-passed-in-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!