english/libraries/joomla/document/html/html.php
/**
	 * Parse a document template
	 *
	 * @return  The parsed contents of the template
	 *
	 * @since   11.1
	 */
Parse a document template
@return  The parsed contents of the template


Parse a document template @return The parsed contents of the template
protected function _parseTemplate()
	{
		$matches = array();
		if (preg_match_all('#<jdoc:include\ type="([^"]+)" (.*)\/>#iU', $this->_template, $matches))
		{
			$template_tags_first 	= array();
			$template_tags_last 	= array();
			for ($i = count($matches[0])-1; $i >= 0; $i--) {
				$type  		= $matches[1][$i];
				$attribs 	= empty($matches[2][$i]) ? array() : JUtility::parseAttributes($matches[2][$i]);
				$name 		= isset($attribs['name']) ? $attribs['name'] : null;
				if ($type == 'module' || $type == 'modules') {
					$template_tags_first[$matches[0][$i]] = array('type'=>$type, 'name'=>$name, 'attribs'=>$attribs);
				} else {
					$template_tags_last[$matches[0][$i]] = array('type'=>$type, 'name'=>$name, 'attribs'=>$attribs);
				}
			}
			$template_tags_last = array_reverse($template_tags_last);
			$this->_template_tags = $template_tags_first + $template_tags_last;
		}
	}
protected function _parseTemplate ( ) { $ matches = array ( ) ; if ( preg_match_all ( '#<jdoc:include\ type="([^"]+)" (.*)\/>#iU' , $ this -> _template , $ matches ) ) { $ template_tags_first = array ( ) ; $ template_tags_last = array ( ) ; for ( $ i = count ( $ matches [ 0 ] ) - 1 ; $ i >= 0 ; $ i -- ) { $ type = $ matches [ 1 ] [ $ i ] ; $ attribs = empty ( $ matches [ 2 ] [ $ i ] ) ? array ( ) : JUtility :: parseAttributes ( $ matches [ 2 ] [ $ i ] ) ; $ name = isset ( $ attribs [ 'name' ] ) ? $ attribs [ 'name' ] : null ; if ( $ type == 'module' || $ type == 'modules' ) { $ template_tags_first [ $ matches [ 0 ] [ $ i ] ] = array ( 'type' => $ type , 'name' => $ name , 'attribs' => $ attribs ) ; } else { $ template_tags_last [ $ matches [ 0 ] [ $ i ] ] = array ( 'type' => $ type , 'name' => $ name , 'attribs' => $ attribs ) ; } } $ template_tags_last = array_reverse ( $ template_tags_last ) ; $ this -> _template_tags = $ template_tags_first + $ template_tags_last ; } }
Parse a document template
 @return  The parsed contents of the template
Parse a document template @return The parsed contents of the template
// Step through the jdocs in reverse order. // Separate buffers to be executed first and last // Reverse the last array so the jdocs are in forward order.