protected function compile()
	{		
		// Get the pattern model collection
		$colPattern = \PatternModel::findVisibleByPid($this->objElement->id);

		if ($colPattern === null)
		{
			return;
		}
		
		// Get correct content element id (included content element) see #37
		$intPid = ($this->origId) ? $this->origId : $this->id;
		
		// Get the data
		$colData = \DataModel::findByPid($intPid);

		if ($colData !== null)
		{
			foreach ($colData as $objData)
			{
				$arrData[$objData->pattern] = $objData;
			}							
		}

		// Prepare values for every pattern
		foreach($colPattern as $objPattern)
		{
			if (!Pattern::hasOutput($objPattern->type))
			{
				continue;
			}
			
			$strClass = Pattern::findClass($objPattern->type);
				
			if (!class_exists($strClass))
			{
				System::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
			}
			else
			{
				$objPatternClass = new $strClass($objPattern);
				$objPatternClass->pid = $intPid;
				$objPatternClass->Template = $this->Template;
				$objPatternClass->data = $arrData[$objPattern->alias];
		
				$objPatternClass->compile();
			}
		}
	}
protected function compile()
	{		
		// Get the pattern model collection
		$colPattern = \PatternModel::findVisibleByPid($this->objElement->id);

		if ($colPattern === null)
		{
			return;
		}
		
		// Get correct content element id (included content element) see #37
		$intPid = ($this->origId) ? $this->origId : $this->id;
		
		// Get the data
		$colData = \DataModel::findByPid($intPid);

		if ($colData !== null)
		{
			foreach ($colData as $objData)
			{
				$arrData[$objData->pattern] = $objData;
			}							
		}

		// Prepare values for every pattern
		foreach($colPattern as $objPattern)
		{
			if (!Pattern::hasOutput($objPattern->type))
			{
				continue;
			}
			
			$strClass = Pattern::findClass($objPattern->type);
				
			if (!class_exists($strClass))
			{
				System::log('Pattern element class "'.$strClass.'" (pattern element "'.$objPattern->type.'") does not exist', __METHOD__, TL_ERROR);
			}
			else
			{
				$objPatternClass = new $strClass($objPattern);
				$objPatternClass->pid = $intPid;
				$objPatternClass->Template = $this->Template;
				$objPatternClass->data = $arrData[$objPattern->alias];
		
				$objPatternClass->compile();
			}
		}
	}
protected function compile ( ) { // Get the pattern model collection $ colPattern = \ PatternModel :: findVisibleByPid ( $ this -> objElement -> id ) ; if ( $ colPattern === null ) { return ; } // Get correct content element id (included content element) see #37 $ intPid = ( $ this -> origId ) ? $ this -> origId : $ this -> id ; // Get the data $ colData = \ DataModel :: findByPid ( $ intPid ) ; if ( $ colData !== null ) { foreach ( $ colData as $ objData ) { $ arrData [ $ objData -> pattern ] = $ objData ; } } // Prepare values for every pattern foreach ( $ colPattern as $ objPattern ) { if ( ! Pattern :: hasOutput ( $ objPattern -> type ) ) { continue ; } $ strClass = Pattern :: findClass ( $ objPattern -> type ) ; if ( ! class_exists ( $ strClass ) ) { System :: log ( 'Pattern element class "' . $ strClass . '" (pattern element "' . $ objPattern -> type . '") does not exist' , __METHOD__ , TL_ERROR ) ; } else { $ objPatternClass = new $ strClass ( $ objPattern ) ; $ objPatternClass -> pid = $ intPid ; $ objPatternClass -> Template = $ this -> Template ; $ objPatternClass -> data = $ arrData [ $ objPattern -> alias ] ; $ objPatternClass -> compile ( ) ; } } }
Compile the pattern
Compile the pattern