Objective

How to get URL parameters in Joomla PHP pages.

Code 1

$jinput = JFactory::getApplication()->input;
$parameter = $jinput->get('varname', 'default_value', 'filter');

Code 2 (shorter)

$parameter = JFactory::getApplication()->input->get('varname', 'default_value', 'filter');


Most frequently used values for filter:

  • INT, INTEGER
  • STRING
  • BOOL, BOOLEAN

Example

URL: http://www.yoururl.com/index.php?parameter1=value1

$parameter = JFactory::getApplication()->input->get('parameter1', '', 'integer');


Source:

 

Keep Me Informed

Keep me informed of the latest extensions releases and offers. One email maximum per month.

Offer Me A Coffee!

If you like my work, offer me a coffee! Nick.