english/libraries/joomla/document/html/html.php
/**
	 * Fetch the template, and initialise the params
	 *
	 * @param   array  $params  Parameters to determine the template
	 *
	 * @return  void
	 *
	 * @since   11.1
	 */
Fetch the template, and initialise the params
@param   array  $params  Parameters to determine the template

@return  void


Fetch the template and initialise the params @param array $params Parameters to determine the template @return void
protected function _fetchTemplate($params = array())
	{
		$directory	= isset($params['directory']) ? $params['directory'] : 'templates';
		$filter		= JFilterInput::getInstance();
		$template	= $filter->clean($params['template'], 'cmd');
		$file		= $filter->clean($params['file'], 'cmd');
		if (!file_exists($directory . '/' . $template . '/' . $file)) {
			$template = 'system';
		}
		$lang = JFactory::getLanguage();
			$lang->load('tpl_'.$template, JPATH_BASE, null, false, false)
		||	$lang->load('tpl_'.$template, $directory . '/' . $template, null, false, false)
		||	$lang->load('tpl_'.$template, JPATH_BASE, $lang->getDefault(), false, false)
		||	$lang->load('tpl_'.$template, $directory . '/' . $template, $lang->getDefault(), false, false);
		$this->template = $template;
		$this->baseurl  = JURI::base(true);
		$this->params	= isset($params['params']) ? $params['params'] : new JRegistry;
		$this->_template = $this->_loadTemplate($directory . '/' . $template, $file);
	}
protected function _fetchTemplate ( $ params = array ( ) ) { $ directory = isset ( $ params [ 'directory' ] ) ? $ params [ 'directory' ] : 'templates' ; $ filter = JFilterInput :: getInstance ( ) ; $ template = $ filter -> clean ( $ params [ 'template' ] , 'cmd' ) ; $ file = $ filter -> clean ( $ params [ 'file' ] , 'cmd' ) ; if ( ! file_exists ( $ directory . '/' . $ template . '/' . $ file ) ) { $ template = 'system' ; } $ lang = JFactory :: getLanguage ( ) ; $ lang -> load ( 'tpl_' . $ template , JPATH_BASE , null , false , false ) || $ lang -> load ( 'tpl_' . $ template , $ directory . '/' . $ template , null , false , false ) || $ lang -> load ( 'tpl_' . $ template , JPATH_BASE , $ lang -> getDefault ( ) , false , false ) || $ lang -> load ( 'tpl_' . $ template , $ directory . '/' . $ template , $ lang -> getDefault ( ) , false , false ) ; $ this -> template = $ template ; $ this -> baseurl = JURI :: base ( true ) ; $ this -> params = isset ( $ params [ 'params' ] ) ? $ params [ 'params' ] : new JRegistry ; $ this -> _template = $ this -> _loadTemplate ( $ directory . '/' . $ template , $ file ) ; }
Fetch the template, and initialise the params
 @param   array  $params  Parameters to determine the template
Fetch the template and initialise the params @param array $params Parameters to determine the template
// Check // Load the language file for the template // 1.5 or core then 1.6 // Assign the variables // Load