spacer.png, 0 kB
spacer.png, 0 kB
Home arrow Joomla arrow Joomla 1.0.x: mosGetParam() function
Joomla 1.0.x: mosGetParam() function PDF Print E-mail
Written by Administrator   
venerd́, 05 settembre 2008

mosGetParam() is a widely useful Joomla framework function able to read information from other pages or just exchange data in a component or module (for example by GET, POST or COOKIE).
As you can see this function should be preferred to a simple $_GET['var'] PHP instruction.
This function is useful also to clear data from quotes, double quotes, backslashes and null characters (if magic_quotes_gpc is set off).

Here below the command syntax:

mixed mosGetParam(array &$arr, strong $name[, mixed $default = null[, int $mask = 0]]);

$arr the array where collect data (usually $_POST, $_GET global arrays)
$name parameter name
$default default parameter if the value is not found (set to null if omitted)
$mask optional parameter whose values can be:
   _MOS_ALLOWHTML don't strip html tags but only blank space at the beginning and the end
   _MOS_NOTRIM strip html tags but not blank spaces at the beginning and the end
   _MOS_ALLOWRAW a mix of the two options above, data is returned as is

Here's some examples

/* "task" parameter collected via GET (show is the default value) */
$task = mosGetParam($_GET, "task", "show");

/* parameter collected via GET POST or COOKIE (0 is the default value) */
$id = intval(mosGetParam($_REQUEST, "id", 0));

/* "name" parameter collected via POST (null is the default value); no blank space are removed at the end and the beginning */
$name = mosGetParam($_POST, "name", _MOS_NOTRIM);

Last Updated ( venerd́, 05 settembre 2008 )
Next >
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB