Actions

API15

Difference between revisions of "JModel"

From Joomla! Documentation

(New page: <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{Description:JModel}} ===Defined in=== librari...)
 
Line 14: Line 14:
 
|[[API15:JModel/__construct|__construct]]
 
|[[API15:JModel/__construct|__construct]]
 
|Constructor
 
|Constructor
 +
|-
 +
|[[API15:JModel/getInstance|getInstance]]
 +
|Returns a reference to the a Model object, always creating it
 
|-
 
|-
 
|[[API15:JModel/setState|setState]]
 
|[[API15:JModel/setState|setState]]
Line 21: Line 24:
 
|Method to get model state variables
 
|Method to get model state variables
 
|-
 
|-
|[[API15:JModel/getDbo|getDbo]]
+
|[[API15:JModel/getDBO|getDBO]]
 
|Method to get the database connector object
 
|Method to get the database connector object
 
|-
 
|-
|[[API15:JModel/setDbo|setDbo]]
+
|[[API15:JModel/setDBO|setDBO]]
 
|Method to set the database connector object
 
|Method to set the database connector object
 
|-
 
|-
Line 32: Line 35:
 
|[[API15:JModel/getTable|getTable]]
 
|[[API15:JModel/getTable|getTable]]
 
|Method to get a table object, load it if necessary.
 
|Method to get a table object, load it if necessary.
|-
 
|[[API15:JModel/getInstance|getInstance]]
 
|Returns a Model object, always creating it
 
 
|-
 
|-
 
|[[API15:JModel/addIncludePath|addIncludePath]]
 
|[[API15:JModel/addIncludePath|addIncludePath]]

Revision as of 17:10, 22 March 2010

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] 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

Contents

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/model.php

Methods

Method name Description
__construct Constructor
getInstance Returns a reference to the a Model object, always creating it
setState Method to set model state variables
getState Method to get model state variables
getDBO Method to get the database connector object
setDBO Method to set the database connector object
getName Method to get the model name
getTable Method to get a table object, load it if necessary.
addIncludePath Add a directory where JModel should search for models. You may either pass a string or an array of directories.
addTablePath Adds to the stack of model table paths in LIFO order.

Importing

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

[Edit See Also] SeeAlso:JModel

Examples

<CodeExamplesForm />