Вернуться к записям по теме Joomla.
Joomla.Platform\JView
libraries/joomla/application/component/view.php at line 21
Class JView
JObject └─JView
- All Known Subclasses:
- Joomla.Administrator\AdminViewHelp Joomla.Administrator\AdminViewProfile Joomla.Administrator\AdminViewSysinfo Joomla.Administrator\BannersViewBanner Joomla.Administrator\BannersViewBanners Joomla.Administrator\BannersViewClient Joomla.Administrator\BannersViewClients Joomla.Administrator\BannersViewDownload Joomla.Administrator\BannersViewTracks Joomla.Administrator\CacheViewCache Joomla.Administrator\CacheViewPurge Joomla.Administrator\CategoriesViewCategories Joomla.Administrator\CategoriesViewCategory Joomla.Administrator\CheckinViewCheckin Joomla.Administrator\ConfigViewApplication Joomla.Administrator\ConfigViewClose Joomla.Administrator\ConfigViewComponent Joomla.Site\ContactViewCategories Joomla.Site\ContactViewCategory Joomla.Administrator\ContactViewContact Joomla.Site\ContactViewContact Joomla.Administrator\ContactViewContacts Joomla.Site\ContactViewFeatured Joomla.Site\ContentViewArchive Joomla.Administrator\ContentViewArticle Joomla.Site\ContentViewArticle Joomla.Administrator\ContentViewArticles Joomla.Site\ContentViewCategories Joomla.Site\ContentViewCategory Joomla.Administrator\ContentViewFeatured Joomla.Site\ContentViewFeatured Joomla.Site\ContentViewForm Joomla.Administrator\CpanelViewCpanel Joomla.Administrator\InstallerViewDefault Joomla.Installation\JInstallationViewComplete Joomla.Installation\JInstallationViewDatabase Joomla.Installation\JInstallationViewFilesystem Joomla.Installation\JInstallationViewLanguage Joomla.Installation\JInstallationViewLicense Joomla.Installation\JInstallationViewPreinstall Joomla.Installation\JInstallationViewRemove Joomla.Installation\JInstallationViewSite Joomla.Administrator\LanguagesViewInstalled Joomla.Administrator\LanguagesViewLanguage Joomla.Administrator\LanguagesViewLanguages Joomla.Administrator\LanguagesViewMultilangstatus Joomla.Administrator\LoginViewLogin Joomla.Site\MailtoViewMailto Joomla.Site\MailtoViewSent Joomla.Administrator\MediaViewImages Joomla.Administrator\MediaViewImagesList Joomla.Administrator\MediaViewMedia Joomla.Administrator\MediaViewMediaList Joomla.Administrator\MenusViewItem Joomla.Administrator\MenusViewItems Joomla.Administrator\MenusViewMenu Joomla.Administrator\MenusViewMenus Joomla.Administrator\MessagesViewConfig Joomla.Administrator\MessagesViewMessage Joomla.Administrator\MessagesViewMessages Joomla.Administrator\ModulesViewModule Joomla.Administrator\ModulesViewModules Joomla.Administrator\ModulesViewPositions Joomla.Administrator\ModulesViewPreview Joomla.Administrator\ModulesViewSelect Joomla.Site\NewsfeedsViewCategories Joomla.Site\NewsfeedsViewCategory Joomla.Administrator\NewsfeedsViewNewsfeed Joomla.Site\NewsfeedsViewNewsfeed Joomla.Administrator\NewsfeedsViewNewsfeeds Joomla.Administrator\PluginsViewPlugin Joomla.Administrator\PluginsViewPlugins Joomla.Administrator\RedirectViewLink Joomla.Administrator\RedirectViewLinks Joomla.Site\SearchViewSearch Joomla.Administrator\SearchViewSearches Joomla.Administrator\TemplatesViewPrevuuw Joomla.Administrator\TemplatesViewSource Joomla.Administrator\TemplatesViewStyle Joomla.Administrator\TemplatesViewStyles Joomla.Administrator\TemplatesViewTemplate Joomla.Administrator\TemplatesViewTemplates Joomla.Administrator\UsersViewDebugGroup Joomla.Administrator\UsersViewDebugUser Joomla.Administrator\UsersViewGroup Joomla.Administrator\UsersViewGroups Joomla.Administrator\UsersViewLevel Joomla.Administrator\UsersViewLevels Joomla.Site\UsersViewLogin Joomla.Administrator\UsersViewMail Joomla.Site\UsersViewProfile Joomla.Site\UsersViewRegistration Joomla.Site\UsersViewRemind Joomla.Site\UsersViewReset Joomla.Administrator\UsersViewUser Joomla.Administrator\UsersViewUsers Joomla.Site\WeblinksViewCategories Joomla.Site\WeblinksViewCategory Joomla.Site\WeblinksViewForm Joomla.Administrator\WeblinksViewWeblink Joomla.Site\WeblinksViewWeblink Joomla.Administrator\WeblinksViewWeblinks Joomla.Site\WrapperViewWrapper
public class JView extends JObject
- Subpackage:
- Application
- Since:
- 11.1
Field Summary |
protected string |
$_basePath The base path of the view |
protected string |
$_charset Charset to use in escaping mechanisms; defaults to urf8 (UTF-8) |
protected string |
$_defaultModel The default model |
protected string |
$_escape Callback for escaping. |
protected string |
$_layout Layout name |
protected string |
$_layoutExt Layout extension |
protected string |
$_layoutTemplate Layout template |
protected array |
$_models Registered models |
protected array |
$_name The name of the view |
protected string |
$_output The output of the template script. |
protected array |
$_path The set of search directories for resources (templates) |
protected string |
$_template The name of the default template source file. |
Fields inherited from Joomla.Platform\JObject |
_errors |
Method Summary |
void |
display(string The, mixed tpl) Execute and display a template script. |
boolean |
assign() Assigns variables to the view script via differing strategies.
|
boolean |
assignRef(string key, mixed &$val, mixed val) Assign variable for the view (by reference).
|
mixed |
escape(mixed The, mixed var) Escapes a value for output in a view script.
|
mixed |
get(string The, string property, mixed default) Method to get data from a registered model or a property of the view |
mixed |
getModel(string The, mixed name) Method to get the model object |
string |
getLayout() Get the layout. |
string |
getLayoutTemplate() Get the layout template. |
string |
getName() Method to get the view nameThe model name by default parsed using the classname, or it can be set
by passing a $config['name'] in the class constructor |
object |
setModel(object model, boolean default) Method to add a model to the view. |
string |
setLayout(string The, mixed layout) Sets the layout name to use |
string |
setLayoutExt(string The, mixed value) Allows a different extension for the layout files to be used |
void |
setEscape(mixed The, mixed spec) Sets the _escape() callback. |
void |
addTemplatePath(string|array The, mixed path) Adds to the stack of view script paths in LIFO order. |
void |
addHelperPath(string|array The, mixed path) Adds to the stack of helper script paths in LIFO order. |
string |
loadTemplate(string The, mixed tpl) Load a template file -- first look in the templates folder for an override |
boolean |
loadHelper(string The, mixed hlp) Load a helper file |
protected void |
_setPath(string|array The, mixed type, mixed path) Sets an entire array of search paths for templates or resources. |
protected void |
_addPath(string|array The, mixed type, mixed path) Adds to the search path for templates and resources. |
protected string |
_createFileName(string type, array parts) Create the filename for a resource |
Methods inherited from Joomla.Platform\JObject |
__construct, __toString, def, get, getError, getErrors, getProperties, set, setError, setProperties, toString |
Field Detail
libraries/joomla/application/component/view.php at line 42
_basePath
protected string $_basePath = null
The base path of the view
libraries/joomla/application/component/view.php at line 105
_charset
protected string $_charset = 'UTF-8'
Charset to use in escaping mechanisms; defaults to urf8 (UTF-8)
libraries/joomla/application/component/view.php at line 49
_defaultModel
protected string $_defaultModel = null
libraries/joomla/application/component/view.php at line 98
_escape
protected string $_escape = 'htmlspecialchars'
libraries/joomla/application/component/view.php at line 56
_layout
protected string $_layout = 'default'
libraries/joomla/application/component/view.php at line 63
_layoutExt
protected string $_layoutExt = 'php'
libraries/joomla/application/component/view.php at line 70
_layoutTemplate
protected string $_layoutTemplate = '_'
libraries/joomla/application/component/view.php at line 35
_models
protected array $_models = array()
libraries/joomla/application/component/view.php at line 28
_name
protected array $_name = null
libraries/joomla/application/component/view.php at line 91
_output
protected string $_output = null
The output of the template script.
libraries/joomla/application/component/view.php at line 77
_path
protected array $_path = array(...)
The set of search directories for resources (templates)
libraries/joomla/application/component/view.php at line 84
_template
protected string $_template = null
The name of the default template source file.
Constructor Detail
libraries/joomla/application/component/view.php at line 111
__construct
public JObject __construct(mixed config, mixed properties)
Constructor
- Parameters:
- properties - Either and associative array or another object to set the initial properties of the object.
- Since:
- 11.1
Method Detail
libraries/joomla/application/component/view.php at line 175
display
public void display(string The, mixed tpl)
Execute and display a template script.
- Parameters:
- The - name of the template file to parse; automatically searches through the template paths.
- Throws:
- object - An JError object.
- See Also:
- fetch()
libraries/joomla/application/component/view.php at line 220
assign
public boolean assign()
Assigns variables to the view script via differing strategies. This method is overloaded; you can assign all the properties of
an object, an associative array, or a single value by name. You are not allowed to set variables that begin with an underscore;
these are either private properties for JView or private variables
within the template script itself.
$view = new JView;
// Assign directly
$view->var1 = 'something';
$view->var2 = 'else'; // Assign by name and value
$view->assign('var1', 'something');
$view->assign('var2', 'else'); // Assign by assoc-array
$ary = array('var1' => 'something', 'var2' => 'else');
$view->assign($obj); // Assign by object
$obj = new stdClass;
$obj->var1 = 'something';
$obj->var2 = 'else';
$view->assign($obj);
- Returns:
- True on success, false on failure.
libraries/joomla/application/component/view.php at line 289
assignRef
public boolean assignRef(string key, mixed &$val, mixed val)
Assign variable for the view (by reference). You are not allowed to set variables that begin with an underscore;
these are either private properties for JView or private variables
within the template script itself.
$view = new JView;
// Assign by name and value
$view->assignRef('var1', $ref); // Assign directly
$view->ref = &$var1;
- Parameters:
- key - The name for the reference in the view.
- &$val - The referenced variable.
- Returns:
- True on success, false on failure.
libraries/joomla/application/component/view.php at line 309
escape
public mixed escape(mixed The, mixed var)
Escapes a value for output in a view script. If escaping mechanism is either htmlspecialchars or htmlentities, uses
$_encoding setting.
- Parameters:
- The - output to escape.
- Returns:
- The escaped value.
libraries/joomla/application/component/view.php at line 325
get
public mixed get(string The, string property, mixed default)
Method to get data from a registered model or a property of the view
- Parameters:
- The - name of the method to call on the model or the property to get
- The - name of the model to reference or the default value [optional]
- Returns:
- The return value of the method
- Since:
- 11.1
- See Also:
- getProperties()
libraries/joomla/application/component/view.php at line 363
getModel
public mixed getModel(string The, mixed name)
Method to get the model object
- Parameters:
- The - name of the model (optional)
- Returns:
- JModel object
libraries/joomla/application/component/view.php at line 376
getLayout
public string getLayout()
Get the layout.
- Returns:
- The layout name
libraries/joomla/application/component/view.php at line 386
getLayoutTemplate
public string getLayoutTemplate()
Get the layout template.
- Returns:
- The layout template name
libraries/joomla/application/component/view.php at line 400
getName
public string getName()
Method to get the view name The model name by default parsed using the classname, or it can be set
by passing a $config['name'] in the class constructor
- Returns:
- The name of the model
- Since:
- 11.1
libraries/joomla/application/component/view.php at line 432
setModel
public object setModel(object model, boolean default)
Method to add a model to the view. We support a multiple model single
view system by which models are referenced by classname. A caveat to the
classname referencing is that any classname prepended by JModel will be
referenced by the name without JModel, eg. JModelCategory is just
Category.
- Parameters:
- model - The model to add to the view.
- default - Is this the default model?
- Returns:
- The added model
libraries/joomla/application/component/view.php at line 451
setLayout
public string setLayout(string The, mixed layout)
Sets the layout name to use
- Parameters:
- The - layout name or a string in format :
- Returns:
- Previous value
- Since:
- 11.1
libraries/joomla/application/component/view.php at line 476
setLayoutExt
public string setLayoutExt(string The, mixed value)
Allows a different extension for the layout files to be used
- Parameters:
- The - extension
- Returns:
- Previous value
- Since:
- 11.1
libraries/joomla/application/component/view.php at line 490
setEscape
public void setEscape(mixed The, mixed spec)
Sets the _escape() callback.
- Parameters:
- The - callback for _escape() to use.
libraries/joomla/application/component/view.php at line 501
addTemplatePath
public void addTemplatePath(string|array The, mixed path)
Adds to the stack of view script paths in LIFO order.
- Parameters:
- The - directory (-ies) to add.
libraries/joomla/application/component/view.php at line 512
addHelperPath
public void addHelperPath(string|array The, mixed path)
Adds to the stack of helper script paths in LIFO order.
- Parameters:
- The - directory (-ies) to add.
libraries/joomla/application/component/view.php at line 524
loadTemplate
public string loadTemplate(string The, mixed tpl)
Load a template file -- first look in the templates folder for an override
- Parameters:
- The - name of the template source file ... automatically searches the template paths and compiles as needed.
- Returns:
- The output of the the template script.
libraries/joomla/application/component/view.php at line 600
loadHelper
public boolean loadHelper(string The, mixed hlp)
Load a helper file
- Parameters:
- The - name of the helper source file ... automatically searches the helper paths and compiles as needed.
- Returns:
- Returns true if the file was loaded
libraries/joomla/application/component/view.php at line 622
_setPath
protected void _setPath(string|array The, mixed type, mixed path)
Sets an entire array of search paths for templates or resources.
- Parameters:
- The - type of path to set, typically 'template'.
- The - new set of search paths. If null or false, resets to the current directory only.
libraries/joomla/application/component/view.php at line 654
_addPath
protected void _addPath(string|array The, mixed type, mixed path)
Adds to the search path for templates and resources.
- Parameters:
- The - directory or stream to search.
libraries/joomla/application/component/view.php at line 686
_createFileName
protected string _createFileName(string type, array parts)
Create the filename for a resource
- Parameters:
- type - The resource type to create the filename for
- parts - An associative array of filename information
- Returns:
- The filename
- Since:
- 11.1
Вернуться к записям по теме Joomla.
|
Base class for a Joomla View
Class holding methods for displaying presentation data.