Source for file html.php
Documentation is available at html.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @package Joomla.Libraries
* The output of the template script.
* The name of the default template source file.
* The set of search directories for resources (templates)
protected $_path =
array('template' =>
array(), 'helper' =>
array());
* Method to instantiate the view.
* @param JModel $model The model object.
* @param SplPriorityQueue $paths The paths queue.
public function __construct(JModel $model, SplPriorityQueue $paths =
null)
$component =
preg_replace('/[^A-Z0-9_\.-]/i', '', $component);
$paths->insert(JPATH_THEMES .
'/' .
$app->getTemplate() .
'/html/' .
$component .
'/' .
$this->getName(), 2);
parent::__construct($model, $paths);
* Load a template file -- first look in the templates folder for an override
* @param string $tpl The name of the template source file; automatically searches the template paths and compiles as needed.
* @return string The output of the the template script.
$layout =
$this->getLayout();
// Create the template file name based on the layout
$file = isset
($tpl) ?
$layout .
'_' .
$tpl :
$layout;
$tpl = isset
($tpl) ?
preg_replace('/[^A-Z0-9_\.-]/i', '', $tpl) :
$tpl;
// Load the language file for the template
$lang->load('tpl_' .
$template, JPATH_BASE, null, false, true)
||
$lang->load('tpl_' .
$template, JPATH_THEMES .
"/$template", null, false, true);
// Change the template folder if alternative layout is in different template
/* if (isset($layoutTemplate) && $layoutTemplate != '_' && $layoutTemplate != $template)
$this->_path['template'] = str_replace($template, $layoutTemplate, $this->_path['template']);
// Prevents adding path twise
if (empty($this->_path['template']))
$defaultPath =
$this->paths->current();
$templatePath =
$this->paths->current();
$this->_path['template'] =
array($defaultPath, $templatePath);
// Load the template script
// If alternate layout can't be found, fall back to default layout
$filetofind =
$this->_createFileName('', array('name' =>
'default' .
(isset
($tpl) ?
'_' .
$tpl :
$tpl)));
// Unset so as not to introduce into template scope
// Never allow a 'this' property
// Start capturing output into a buffer
// Include the requested template filename in the local scope
// (this will execute the view logic).
// Done with the requested template; get the buffer and
throw
new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_LAYOUTFILE_NOT_FOUND', $file), 500);
* Create the filename for a resource
* @param string $type The resource type to create the filename for
* @param array $parts An associative array of filename information
* @return string The filename
* 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
* @return string The name of the model
$viewpos =
strpos($classname, 'View');
throw
new Exception(JText::_('JLIB_APPLICATION_ERROR_VIEW_GET_NAME'), 500);
$lastPart =
substr($classname, $viewpos +
4);
if (!empty($pathParts[1]))
Documentation generated on Tue, 19 Nov 2013 15:04:48 +0100 by phpDocumentor 1.4.3