문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top