public function POMTemplate( $text )
	{
		$this->children = null; // forcefully ignore children

		# Remove curly braces at the beginning and at the end
		$text = substr( $text, 2, strlen( $text ) - 4 );

		# Split by pipe
		$parts = explode( '|', $text );

		# Check if this is a function call in the form #name:
		$first_part = array_shift( $parts );
		if ( strpos( trim( $first_part ), "#" ) == 0 )
			if ( strpos( $first_part, ":" ) !== False ) {
				$splitted = explode( ':', $first_part, 2 );
				if ( count( $splitted ) == 2 ) {
					$first_part = $splitted[0];
					array_unshift( $parts, $splitted[1] );
				}

			}

		$this->title_triple = new POMUtilTrimTriple( $first_part );

		foreach ( $parts as $part )
		{
			$this->parameters[] = POMTemplateParameter::parse( $part );
		}
	}
Example #2
0
 /**
  * Constructs a new template. In order to createa a new empty template, one should:<br/>
  * *call the constructor with a string, e.g. $template = new POMTemplate('{{TEMPLATENAME}}');<br/>
  * *and then start adding parameters with $template->setParameter("NAME", "TEXTVALUE");
  *
  * @param string $text The original text of the element.
  * @return POMTemplate
  */
 public function POMTemplate($text)
 {
     $this->children = null;
     // forcefully ignore children
     # Remove curly braces at the beginning and at the end
     $text = substr($text, 2, strlen($text) - 4);
     # Split by pipe
     $parts = split('\\|', $text);
     $this->title = new POMUtilTrimTriple(array_shift($parts));
     $this->id = "template" . POMElement::$elementCounter;
     POMElement::$elementCounter++;
     //		$this->nodeText = $text;
     foreach ($parts as $part) {
         $this->parameters[] = POMTemplateParameter::parse($part);
     }
 }