src/UI/Template.php
public function create()
	{
		$out	= $this->template;																	//  local copy of set template
		$out	= $this->loadNestedTemplates( $out );												//  search for nested templates and load them
		
		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'pre' )
				$out	= $plugin->work( $out );

 		$out	= preg_replace( '/<%--.*--%>/sU', '', $out );										//  remove template engine style comments
 		if( self::$removeComments )																	//  HTML comments should be removed
			$out	= preg_replace( '/<!--.+-->/sU', '', $out );									//  find and remove all HTML comments 
 		if( self::$removeOptional )																	//  optional parts should be removed
			$out	= preg_replace( '/<%\?--.+--%>/sU', '', $out );									//  find and remove optional parts
		else																						//  otherwise
			$out	= preg_replace( '/<%\?--(.+)--%>/sU', '\\1', $out );							//  find, remove markup but keep content

		foreach( $this->elements as $label => $element )											//  iterate over all registered element containers
		{
			$tmp = '';																				//  
			if( is_object( $element ) )																//  element is an object
			{
				if( !( $element instanceof $this->className ) )										//  object is not an template of this template engine
					continue;																		//  skip this one
				$element = $element->create();														//  render template before concat
			}
			$tmp	.= $element;
			$out	= preg_replace( '/<%(\?)?' . preg_quote( $label, '/' ) . '%>/', $tmp, $out );	//  find placeholder and set in content
 		}
		$out = preg_replace( '/<%\?.*%>/U', '', $out );    											//  remove left over optional placeholders
#        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks

		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'post' )
				$out	= $plugin->work( $out );

		$tags = array();																			//  create container for left over placeholders
		if( preg_match_all( '/<%.*%>/U', $out, $tags ) === 0 )										//  no more placeholders left over
		    return $out; 																			//  return final result

		$tags	= array_shift( $tags );																//  
		foreach( $tags as $key => $value )
			$tags[$key]	= preg_replace( '@(<%\??)|%>@', "", $value );
		if( $this->fileName )
			throw new Exception_Template( Exception_Template::FILE_LABELS_MISSING, $this->fileName, $tags );
		throw new Exception_Template( Exception_Template::LABELS_MISSING, NULL, $tags );
	}
public function create()
	{
		$out	= $this->template;																	//  local copy of set template
		$out	= $this->loadNestedTemplates( $out );												//  search for nested templates and load them
		
		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'pre' )
				$out	= $plugin->work( $out );

 		$out	= preg_replace( '/<%--.*--%>/sU', '', $out );										//  remove template engine style comments
 		if( self::$removeComments )																	//  HTML comments should be removed
			$out	= preg_replace( '/<!--.+-->/sU', '', $out );									//  find and remove all HTML comments 
 		if( self::$removeOptional )																	//  optional parts should be removed
			$out	= preg_replace( '/<%\?--.+--%>/sU', '', $out );									//  find and remove optional parts
		else																						//  otherwise
			$out	= preg_replace( '/<%\?--(.+)--%>/sU', '\\1', $out );							//  find, remove markup but keep content

		foreach( $this->elements as $label => $element )											//  iterate over all registered element containers
		{
			$tmp = '';																				//  
			if( is_object( $element ) )																//  element is an object
			{
				if( !( $element instanceof $this->className ) )										//  object is not an template of this template engine
					continue;																		//  skip this one
				$element = $element->create();														//  render template before concat
			}
			$tmp	.= $element;
			$out	= preg_replace( '/<%(\?)?' . preg_quote( $label, '/' ) . '%>/', $tmp, $out );	//  find placeholder and set in content
 		}
		$out = preg_replace( '/<%\?.*%>/U', '', $out );    											//  remove left over optional placeholders
#        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks

		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'post' )
				$out	= $plugin->work( $out );

		$tags = array();																			//  create container for left over placeholders
		if( preg_match_all( '/<%.*%>/U', $out, $tags ) === 0 )										//  no more placeholders left over
		    return $out; 																			//  return final result

		$tags	= array_shift( $tags );																//  
		foreach( $tags as $key => $value )
			$tags[$key]	= preg_replace( '@(<%\??)|%>@', "", $value );
		if( $this->fileName )
			throw new Exception_Template( Exception_Template::FILE_LABELS_MISSING, $this->fileName, $tags );
		throw new Exception_Template( Exception_Template::LABELS_MISSING, NULL, $tags );
	}
public function create ( ) { $ out = $ this -> template ; //  local copy of set template $ out = $ this -> loadNestedTemplates ( $ out ) ; //  search for nested templates and load them foreach ( $ this -> plugins as $ plugin ) if ( $ plugin -> type == 'pre' ) $ out = $ plugin -> work ( $ out ) ; $ out = preg_replace ( '/<%--.*--%>/sU' , '' , $ out ) ; //  remove template engine style comments if ( self :: $ removeComments ) //  HTML comments should be removed $ out = preg_replace ( '/<!--.+-->/sU' , '' , $ out ) ; //  find and remove all HTML comments  if ( self :: $ removeOptional ) //  optional parts should be removed $ out = preg_replace ( '/<%\?--.+--%>/sU' , '' , $ out ) ; //  find and remove optional parts else //  otherwise $ out = preg_replace ( '/<%\?--(.+)--%>/sU' , '\\1' , $ out ) ; //  find, remove markup but keep content foreach ( $ this -> elements as $ label => $ element ) //  iterate over all registered element containers { $ tmp = '' ; //   if ( is_object ( $ element ) ) //  element is an object { if ( ! ( $ element instanceof $ this -> className ) ) //  object is not an template of this template engine continue ; //  skip this one $ element = $ element -> create ( ) ; //  render template before concat } $ tmp .= $ element ; $ out = preg_replace ( '/<%(\?)?' . preg_quote ( $ label , '/' ) . '%>/' , $ tmp , $ out ) ; //  find placeholder and set in content } $ out = preg_replace ( '/<%\?.*%>/U' , '' , $ out ) ; //  remove left over optional placeholders #        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks foreach ( $ this -> plugins as $ plugin ) if ( $ plugin -> type == 'post' ) $ out = $ plugin -> work ( $ out ) ; $ tags = array ( ) ; //  create container for left over placeholders if ( preg_match_all ( '/<%.*%>/U' , $ out , $ tags ) === 0 ) //  no more placeholders left over return $ out ; //  return final result $ tags = array_shift ( $ tags ) ; //   foreach ( $ tags as $ key => $ value ) $ tags [ $ key ] = preg_replace ( '@(<%\??)|%>@' , "" , $ value ) ; if ( $ this -> fileName ) throw new Exception_Template ( Exception_Template :: FILE_LABELS_MISSING , $ this -> fileName , $ tags ) ; throw new Exception_Template ( Exception_Template :: LABELS_MISSING , NULL , $ tags ) ; }
Creates an output string from the templatefile where all labels will be replaced with apropriate elements.
If a non optional label wasn't specified, the method will throw a Template Exception
@access		public
@return		string
Creates an output string from the templatefile where all labels will be replaced with apropriate elements . If a non optional label wasn t specified the method will throw a Template Exception