API15:JController/execute
From Joomla! Documentation
Description
Execute a task by triggering a method in the derived class.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
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
mixed|false The value returned by the called method, false in error case.
Defined in
libraries/joomla/application/component/controller.php
Importing
jimport( 'joomla.application.component.controller' );
Source Body
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 edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples