Question

i was digging this piece of code in JOOMLA

$input = JFactory::getApplication()->input;
$controller->execute($input->getCmd('task'));

80% i understood but stuck at 'task' thing.

Documentation says that getCMD

* The default behaviour is fetching variables depending on the
 * current request method: GET and HEAD will result in returning
 * an entry from $_GET, POST and PUT will result in returning an
 * entry from $_POST.
 *
 * You can force the source by setting the $hash parameter:
 *
 * post    $_POST
 * get     $_GET
 * files   $_FILES
 * cookie  $_COOKIE
 * env     $_ENV
 * server  $_SERVER
 * method  via current $_SERVER['REQUEST_METHOD']
 * default $_REQUEST

i just search almost all variable in netbeans debug session but unable to find task variable.

Now my question is what this 'task' thing points to ? what it represents?

Was it helpful?

Solution

Basically a task in joomla 2.5 represents a function in a controller of your component. When you have an url like index.php?option=com_foo&task=comment.edit the function "Edit" in the controller Comment of the component com_foo is called.

For example here is a controller DPAttachmentsControllerAttachment with a download function The url looks like index.php?option=com_dpattachments&task=attachment.download.

Hope this is what you are looking for.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top