JModel/1.5
From Joomla! Documentation
< JModel(Difference between revisions)
(Layout updates) |
m (→See also: fixing link to API) |
||
| Line 75: | Line 75: | ||
<source lang="php">jimport( 'joomla.application.component.model' );</source> | <source lang="php">jimport( 'joomla.application.component.model' );</source> | ||
===See also=== | ===See also=== | ||
| − | * {{JVer|1.5}} '''JModel''' on [http://api.joomla.org/Joomla-Framework/Application/JModel.html api.joomla.org] | + | * {{JVer|1.5}} '''JModel''' on [http://api.joomla.org/1.5/Joomla-Framework/Application/JModel.html api.joomla.org] |
* {{JVer|1.5}} '''JModel source code''' on [[jframework15:application/component/model.php|JoomlaCode]] | * {{JVer|1.5}} '''JModel source code''' on [[jframework15:application/component/model.php|JoomlaCode]] | ||
* {{JVer|1.5}} Subpackage [[Subpackage Application/1.5|Application]] | * {{JVer|1.5}} Subpackage [[Subpackage Application/1.5|Application]] | ||
Latest revision as of 16:04, 13 February 2013
[edit]
JModel
[edit] Description
JModel is an abstract class which provides the basic functionality for concrete model objects in conjunction with Joomla's MVC pattern. Models that extend the JModel class are often defined in Joomla components and define the business logic of the specific component. See MVC Development in Joomla
[edit] 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.
[edit] Methods
| Visibility | Method name | Description |
|---|---|---|
| public | __construct | Constructor. |
| public | _createFileName | Create the filename for a resource. |
| public | _createTable | Method to load and return a model object. |
| public | _getList | Returns an object list. |
| public | _getListCount | Returns a record count for the query. |
| public | addIncludePath | Add a directory where should search for models. |
| public | getDBO | Method to get the database connector object. |
| public | getInstance | Returns a reference to the a Model object, always creating it. |
| public | getName | Method to get the model name. |
| public | getState | Method to get model state variables. |
| public | getTable | Method to get a table object, load it if necessary. |
| public | setDBO | Method to set the database connector object. |
| public | setState | Method to set model state variables. |
| public | addTablePath | Adds to the stack of model table paths in LIFO order. |
- Defined in libraries/joomla/application/component/model.php
- Extends JObject
[edit] Importing
jimport( 'joomla.application.component.model' );
[edit] See also
-
JModel on api.joomla.org
-
JModel source code on JoomlaCode
-
Subpackage Application
- Other versions of JModel
SeeAlso:JModel [Edit See Also]
[edit] User contributed notes
<CodeExamplesForm />