Actions

API17

Difference between revisions of "JController"

From Joomla! Documentation

(Bulk upload by Doxiki2)
 
(Layout updates)
Line 6: Line 6:
 
===Defined in===
 
===Defined in===
 
libraries/joomla/application/component/controller.php
 
libraries/joomla/application/component/controller.php
 +
* see source code in [[jplatform:application/component/controller.php|BitBucket]]
 
===Subpackage===
 
===Subpackage===
 
[[Subpackage Application/11.1|Application]]
 
[[Subpackage Application/11.1|Application]]
Line 104: Line 105:
 
<source lang="php">jimport( 'joomla.application.component.controller' );</source>
 
<source lang="php">jimport( 'joomla.application.component.controller' );</source>
 
===See also===
 
===See also===
 +
* JController source code in [[jplatform:application/component/controller.php|BitBucket]]
 
* [[JController|Other versions of this class]]
 
* [[JController|Other versions of this class]]
 
{{SeeAlso:JController}}
 
{{SeeAlso:JController}}

Revision as of 16:51, 23 April 2011

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

[Edit Descripton] JController is an abstract class which provides the basic functionality for your own Controller classes which your create for your components. The Controller is part of Joomla's MVC Pattern. Learn how to develop a component using MVC

The Joomla MVC Design Pattern

Model-View-Controller (MVC) is a set of design patterns, that are used to separate the different layers of your application.

  • The View displays the data of the model by passing it to a template. The view object can therefore access the data of the model. Joomla implements the basic functionality in the abstract JView class.
  • The Model stores the data of the application, and contains the business logic. Joomla implements the basic functionality in the abstract JModel class.
  • The Controller handles the user requests and evokes the model and the views to change it's state. Joomla implements the basic functionality in the JController class.

Defined in

libraries/joomla/application/component/controller.php

Subpackage

Application

Extends

JObject

Extended by

Methods

Method name Description
__construct Constructor.
addViewPath Add one or more view paths to the controller's stack, in LIFO order.
authorise Authorisation check.
authorize Authorisation check.
display Typical view method for MVC based architecture.
execute Execute a task by triggering a method in the derived class.
getModel Method to get a model object, loading it if required.
getName Method to get the controller name.
getTask Get the last task that is being performed or was most recently performed.
getTasks Gets the available tasks in the controller.
getView Method to get a reference to the current view and load it if necessary.
redirect Redirects the browser or returns false if no redirect is set.
registerDefaultTask Register the default task to perform if a mapping is not found.
registerTask Register (map) a task to a method in the class.
setAccessControl Sets the access control levels.
setMessage Sets the internal message that is passed with a redirect.
setRedirect Set a URL for browser redirection.
addModelPath Adds to the stack of model paths in LIFO order.
getInstance Method to get a singleton controller instance.
addPath Adds to the search path for templates and resources.
checkEditId Method to check whether an ID is in the edit list.
createModel Method to load and return a model object.
createView Method to load and return a view object.
holdEditId Method to add a record ID to the edit list.
releaseEditId Method to check whether an ID is in the edit list.
setPath Sets an entire array of search paths for resources.
createFileName Create the filename for a resource.

Importing

jimport( 'joomla.application.component.controller' );

See also

SeeAlso:JController [Edit See Also]

Examples

<CodeExamplesForm />