API15

JView/ construct

From Joomla! Documentation

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.

Description

Syntax

Defined in

libraries/joomla/application/component/view.php

Importing

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

Source Body

function __construct($config=array()){//set the view nameif(empty($this->_name )){if(array_key_exists('name',$config)){$this->_name =$config['name'];}else{$this->_name =$this->getName();}}// set the charset (used by the variable escaping functions)if(array_key_exists('charset',$config)){$this->_charset =$config['charset'];}// user-defined escaping callbackif(array_key_exists('escape',$config)){$this->setEscape($config['escape']);}// Set a base path for use by the viewif(array_key_exists('base_path',$config)){$this->_basePath =$config['base_path'];}else{$this->_basePath = JPATH_COMPONENT;}// set the default template search pathif(array_key_exists('template_path',$config)){// user-defined dirs$this->_setPath('template',$config['template_path']);}else{$this->_setPath('template',$this->_basePath.DS.'views'.DS.$this->getName().DS.'tmpl');}// set the default helper search pathif(array_key_exists('helper_path',$config)){// user-defined dirs$this->_setPath('helper',$config['helper_path']);}else{$this->_setPath('helper',$this->_basePath.DS.'helpers');}// set the layoutif(array_key_exists('layout',$config)){$this->setLayout($config['layout']);}else{$this->setLayout('default');}$this->baseurl= JURI::base(true);}