JController
Base class for a Joomla Controller
Controller (Controllers are where you put all the actual code.) Provides basic functionality, such as rendering views (aka displaying templates).
Located in /libraries/joomla/application/component/controller.php (line 22)
JObject (Subpackage Base)
![]()
JController (Subpackage Application)
| Class | Description |
|---|---|
JControllerForm
|
Controller tailored to suit most form-based admin operations. |
JControllerAdmin
|
Base class for a Joomla Administrator Controller |
mixed
createView
(string $name, [string $prefix = ''], [string $type = ''], [array $config = array()])
object Reference
getView
([string $name = ''], [string $type = ''], [string $prefix = ''], [array $config = array()])
string
$basePath
(line 49)
The base path of the controller
string
$default_view
(line 57)
The default view for the display method.
string
$doTask
(line 66)
The mapped task that was performed.
JController
$instance
(line 152)
string
$message
(line 75)
Redirect message.
string
$messageType
(line 84)
Redirect message type.
array
$methods
(line 93)
Array of class methods
string
$model_prefix
(line 110)
The prefix of the models
array
$name
(line 102)
The name of the controller
array
$paths
(line 119)
The set of search directories for resources (views).
string
$redirect
(line 128)
URL for redirection.
string
$task
(line 137)
Current or most recently performed task.
array
$taskMap
(line 146)
Array of class methods to call for a given task.
string
$_acoSection
(line 31)
ACO Section for the controller.
string
$_acoSectionValue
(line 40)
Default ACO Section value for the controller.
Inherited Variables
Inherited from JObject
JObject::$_errors
Constructor.
- array $config: An optional associative array of configuration settings. Recognized key values include 'name', 'default_task', 'model_path', and 'view_path' (this list is not meant to be comprehensive).
- JObject::__construct()
- Class constructor, overridden in descendant classes.
- JControllerForm::__construct() : Constructor.
- JControllerAdmin::__construct() : Constructor.
Adds to the stack of model paths in LIFO order.
- mixed $path: The directory (string), or list of directories (array) to add.
- string $prefix: A prefix for models
Adds to the search path for templates and resources.
- string $type: The path type (e.g. 'model', 'view').
- mixed $path: The directory string or stream array to search.
Add one or more view paths to the controller's stack, in LIFO order.
- mixed $path: The directory (string) or list of directories (array) to add.
Authorisation check
- string $task: The ACO Section Value to check access on.
Authorisation check
- string $task: The ACO Section Value to check access on
Method to check whether an ID is in the edit list.
- string $context: The context for the session storage.
- integer $id: The ID of the record to add to the edit list.
Create the filename for a resource.
- string $type: The resource type to create the filename for.
- array $parts: An associative array of filename information. Optional.
Method to load and return a model object.
- string $name: The name of the model.
- string $prefix: Optional model prefix.
- array $config: Configuration array for the model. Optional.
Method to load and return a view object. This method first looks in the current template directory for a match and, failing that, uses a default set path to load the view class file.
Note the "name, prefix, type" order of parameters, which differs from the "name, type, prefix" order used in related public methods.
- string $name: The name of the view.
- string $prefix: Optional prefix for the view class name.
- string $type: The type of view.
- array $config: Configuration array for the view. Optional.
Typical view method for MVC based architecture
This function is provide as a default implementation, in most cases you will need to override it in your own controllers.
- boolean $cachable: If true, the view output will be cached
- array $urlparams: An array of safe url parameters and their variable types, for valid values see JFilterInput::clean().
- JControllerAdmin::display() : Display is not supported by this controller.
Execute a task by triggering a method in the derived class.
- string $task: The task to perform. If no matching task is found, the '__default' task is executed, if defined.
Method to get a singleton controller instance.
- string $prefix: The prefix for the controller.
- array $config: An array of optional constructor options.
Method to get a model object, loading it if required.
- string $name: The model name. Optional.
- string $prefix: The class prefix. Optional.
- array $config: Configuration array for model. Optional.
- JControllerForm::getModel() : Method to get a model object, loading it if required.
Method to get the controller name
The dispatcher name is set by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor
Get the last task that is being performed or was most recently performed.
Method to get a reference to the current view and load it if necessary.
- string $name: The view name. Optional, defaults to the controller name.
- string $type: The view type. Optional.
- string $prefix: The class prefix. Optional.
- array $config: Configuration array for view. Optional.
Method to add a record ID to the edit list.
- string $context: The context for the session storage.
- integer $id: The ID of the record to add to the edit list.
Redirects the browser or returns false if no redirect is set.
Register the default task to perform if a mapping is not found.
- string $method: The name of the method in the derived class to perform if a named task is not found.
Register (map) a task to a method in the class.
- string $task: The task.
- string $method: The name of the method in the derived class to perform for this task.
Method to check whether an ID is in the edit list.
- string $context: The context for the session storage.
- integer $id: The ID of the record to add to the edit list.
Sets the access control levels.
- string $section: The ACO section (eg, the component).
- string $value: The ACO section value (if using a constant value).
Sets the internal message that is passed with a redirect
- string $text: Message to display on redirect.
- string $type: Message type (since 11.1). Optional, defaults to 'message'.
Sets an entire array of search paths for resources.
- string $type: The type of path to set, typically 'view' or 'model'.
- string $path: The new set of search paths. If null or false, resets to the current directory only.
Set a URL for browser redirection.
- string $url: URL to redirect to.
- string $msg: Message to display on redirect. Optional, defaults to value set internally by controller, if any.
- string $type: Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage.
Unregister (unmap) a task in the class.
- string $task: The task.
Inherited Methods
Inherited From JObject
JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()

static
static