JController/execute
From Joomla! Documentation
< API16:JController
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Execute a task by triggering a method in the derived class.
<! removed transcluded page call, red link never existed >
Syntax[edit]
execute($task)
Parameter Name | Default Value | Description |
---|---|---|
$task | The task to perform. If no matching task is found, the '__default' task is executed, if defined. |
Returns[edit]
mixed|false The value returned by the called method, false in error case.
Defined in[edit]
libraries/joomla/application/component/controller.php
Importing[edit]
jimport( 'joomla.application.component.controller' );
Source Body[edit]
function execute($task)
{
$this->_task = $task;
$task = strtolower($task);
if (isset($this->_taskMap[$task])) {
$doTask = $this->_taskMap[$task];
} elseif (isset($this->_taskMap['__default'])) {
$doTask = $this->_taskMap['__default'];
} else {
return JError::raiseError(404, JText::_('Task ['.$task.'] not found'));
}
// Record the actual task being fired
$this->_doTask = $doTask;
// Make sure we have access
if ($this->authorize($doTask)) {
$retval = $this->$doTask();
return $retval;
} else {
return JError::raiseError(403, JText::_('ACCESS_FORBIDDEN'));
}
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]