API17

Difference between revisions of "JView"

From Joomla! Documentation

m (JoomlaWikiBot moved page JView/11.1 to API17:JView without leaving a redirect: Robot: Moved page)
m (preparing for archive only)
 
(3 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
=={{JVer|11.1}} JView==
 
=={{JVer|11.1}} JView==
 
===Description===
 
===Description===
{{Description:JView}}
+
[[JView]] is an abstract class which provides the basic functionality for Joomla's MVC design pattern. You need to write your own concrete View classes, to make full use of the functionality.  [[Developing_a_Model-View-Controller_Component_-_Part_1|Learn more]]
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[</nowiki>[[Description:JView|Edit Descripton]]<nowiki>]</nowiki>
+
===The Joomla MVC Design Pattern===
</span>
+
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.
 +
 
 
===Methods===
 
===Methods===
 
{| class="wikitable sortable"
 
{| class="wikitable sortable"
Line 14: Line 19:
 
|-
 
|-
 
|public  
 
|public  
|[[JView::addHelperPath/11.1|addHelperPath]]
+
|[[API17:JView::addHelperPath|addHelperPath]]
 
|Adds to the stack of helper script paths in LIFO order.  
 
|Adds to the stack of helper script paths in LIFO order.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::addTemplatePath/11.1|addTemplatePath]]
+
|[[API17:JView::addTemplatePath|addTemplatePath]]
 
|Adds to the stack of view script paths in LIFO order.  
 
|Adds to the stack of view script paths in LIFO order.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::assign/11.1|assign]]
+
|[[API17:JView::assign|assign]]
 
|Assigns variables to the view script via differing strategies.  
 
|Assigns variables to the view script via differing strategies.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::assignRef/11.1|assignRef]]
+
|[[API17:JView::assignRef|assignRef]]
 
|Assign variable for the view (by reference).  
 
|Assign variable for the view (by reference).  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::display/11.1|display]]
+
|[[API17:JView::display|display]]
 
|Execute and display a template script.  
 
|Execute and display a template script.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::escape/11.1|escape]]
+
|[[API17:JView::escape|escape]]
 
|Escapes a value for output in a view script.  
 
|Escapes a value for output in a view script.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::get/11.1|get]]
+
|[[API17:JView::get|get]]
 
|Method to get data from a registered model or a property of the view.  
 
|Method to get data from a registered model or a property of the view.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::getLayout/11.1|getLayout]]
+
|[[API17:JView::getLayout|getLayout]]
 
|Get the layout.  
 
|Get the layout.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::getLayoutTemplate/11.1|getLayoutTemplate]]
+
|[[API17:JView::getLayoutTemplate|getLayoutTemplate]]
 
|Get the layout template.  
 
|Get the layout template.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::getModel/11.1|getModel]]
+
|[[API17:JView::getModel|getModel]]
 
|Method to get the model object.  
 
|Method to get the model object.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::getName/11.1|getName]]
+
|[[API17:JView::getName|getName]]
 
|Method to get the view name.  
 
|Method to get the view name.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::loadHelper/11.1|loadHelper]]
+
|[[API17:JView::loadHelper|loadHelper]]
 
|Load a helper file.  
 
|Load a helper file.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::loadTemplate/11.1|loadTemplate]]
+
|[[API17:JView::loadTemplate|loadTemplate]]
 
|Load a template file -- first look in the templates folder for an override.  
 
|Load a template file -- first look in the templates folder for an override.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::setEscape/11.1|setEscape]]
+
|[[API17:JView::setEscape|setEscape]]
 
|Sets the _escape() callback.  
 
|Sets the _escape() callback.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::setLayout/11.1|setLayout]]
+
|[[API17:JView::setLayout|setLayout]]
 
|Sets the layout name to use.  
 
|Sets the layout name to use.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::setLayoutExt/11.1|setLayoutExt]]
+
|[[API17:JView::setLayoutExt|setLayoutExt]]
 
|Allows a different extension for the layout files to be used.  
 
|Allows a different extension for the layout files to be used.  
 
|-
 
|-
 
|public  
 
|public  
|[[JView::setModel/11.1|setModel]]
+
|[[API17:JView::setModel|setModel]]
 
|Method to add a model to the view.  
 
|Method to add a model to the view.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JView::__construct/11.1|__construct]]
+
|[[API17:JView::__construct|__construct]]
 
|Constructor.  
 
|Constructor.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JView::_addPath/11.1|_addPath]]
+
|[[API17:JView::_addPath|_addPath]]
 
|Adds to the search path for templates and resources.  
 
|Adds to the search path for templates and resources.  
 
|-
 
|-
 
|protected  
 
|protected  
|[[JView::_setPath/11.1|_setPath]]
+
|[[API17:JView::_setPath|_setPath]]
 
|Sets an entire array of search paths for templates or resources.  
 
|Sets an entire array of search paths for templates or resources.  
 
|-
 
|-
 
|}
 
|}
 
* '''Defined in''' libraries/joomla/application/component/view.php
 
* '''Defined in''' libraries/joomla/application/component/view.php
* '''Extends''' [[JObject/11.1|JObject]]
+
* '''Extends''' [[API17:JObject|JObject]]
 
===Importing===
 
===Importing===
 
<source lang="php">jimport( 'joomla.application.component.view' );</source>
 
<source lang="php">jimport( 'joomla.application.component.view' );</source>
 
===See also===
 
===See also===
 
* {{JVer|11.1}} '''JView source code''' on [[jplatform:application/component/view.php|BitBucket]]
 
* {{JVer|11.1}} '''JView source code''' on [[jplatform:application/component/view.php|BitBucket]]
* {{JVer|11.1}} Subpackage [[Subpackage Application/11.1|Application]]
+
* {{JVer|11.1}} Subpackage [[API17:Subpackage Application|Application]]
* [[JView|Other versions of JView]]
+
* [[API17:JView|Other versions of JView]]
{{SeeAlso:JView}}
+
 
<span class="editsection" style="font-size:76%;">
+
 
<nowiki>[</nowiki>[[SeeAlso:JView|Edit See Also]]<nowiki>]</nowiki>
 
</span>
 
 
===User contributed notes===
 
===User contributed notes===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
noresultsheader=\n
 
noresultsheader=\n
 
category=JView
 
category=JView
category=CodeExample
+
namespace=CodeExample
 
category=ClassExample
 
category=ClassExample
 
include=*
 
include=*
Line 117: Line 120:
 
format= ,,,
 
format= ,,,
 
</dpl>
 
</dpl>
<noinclude>[[Category:Platform JClasses]][[Category:Platform 11.1]][[Category:JView]]</noinclude>
+
<noinclude>[[Category:Platform 11.1]][[Category:Archived pages API17]]</noinclude>

Latest revision as of 22:56, 24 March 2017

The "API17" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Joomla 11.1 JView[edit]

Description[edit]

JView is an abstract class which provides the basic functionality for Joomla's MVC design pattern. You need to write your own concrete View classes, to make full use of the functionality. Learn more

The Joomla MVC Design Pattern[edit]

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.

Methods[edit]

Visibility Method name Description
public addHelperPath Adds to the stack of helper script paths in LIFO order.
public addTemplatePath Adds to the stack of view script paths in LIFO order.
public assign Assigns variables to the view script via differing strategies.
public assignRef Assign variable for the view (by reference).
public display Execute and display a template script.
public escape Escapes a value for output in a view script.
public get Method to get data from a registered model or a property of the view.
public getLayout Get the layout.
public getLayoutTemplate Get the layout template.
public getModel Method to get the model object.
public getName Method to get the view name.
public loadHelper Load a helper file.
public loadTemplate Load a template file -- first look in the templates folder for an override.
public setEscape Sets the _escape() callback.
public setLayout Sets the layout name to use.
public setLayoutExt Allows a different extension for the layout files to be used.
public setModel Method to add a model to the view.
protected __construct Constructor.
protected _addPath Adds to the search path for templates and resources.
protected _setPath Sets an entire array of search paths for templates or resources.
  • Defined in libraries/joomla/application/component/view.php
  • Extends JObject

Importing[edit]

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

See also[edit]


User contributed notes[edit]

Code Examples[edit]