I'm a beginner in Joomla and a little confused with this method.
for example consider this : $app->input->get('foo',0,'int');
where is the source of foo
?
JInput->get()
get's inputs from where ?
Source of foo
are the PHP superglobals such as $_POST or $_GET. So it's data what the user submits via a form, URL or cookie to your component.
So you are receiving in a safe way a parameter that was sent to you via a HTTP method.
This:
$myVar = $app->input->get('foo',0,'int');
is largely equivalent to:
$myVar = (int) $_REQUEST['foo'];
You should always use JInput, no matter what. You just forget about the PHP superglobals. Read the whole documentation in silence, you should know it by heart.
$_REQUEST['foo']
is set: $myVar = isset($_REQUEST['foo'] ? (int) $_REQUEST['foo'] : 0;
Commented
Aug 27, 2014 at 7:27
$myVar = $app->input->get('foo',0,'int');
is equivalent to $myVar = isset($_REQUEST['foo'] ? (int) $_REQUEST['foo'] : 0;
.
Commented
Aug 27, 2014 at 7:42