-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
It is essential that we sanitize incoming data by removing any unexpected data and ensuring that the data is of an expected type. Joomla! provides us with the static class JRequest, which eliminates the need to directly access the request hashes $_GET, $_POST, $_FILES, $_COOKIE, and $_REQUEST. Using JRequest to its full potential we can perform useful data preprocessing. For detailed information on the JRequest class see Appendix G
, Request and Session Handling.
To access a request value we must use the static JRequest::getVar() method. In this example we get the value of the input id:
$id = JRequest::getVar('id');If we wish we can define a default value; this is the value that will be returned if the request value is not defined. In this example we use the value 0 if the request id is not set:
$id = JRequest::getVar('id', 0);By default JRequest::getVar() obtains data from the $_REQUEST hash. We can specify the source hash of the data as...
Change the font size
Change margin width
Change background colour