Esempio n. 1
0
 public function processVariable(Ajde_Template_Parser $parser)
 {
     $variableName = str_replace(Ajde_Component::AV_XMLNS . ':', '', $this->nodeName);
     if (!$parser->getTemplate()->hasAssigned($variableName)) {
         throw new Ajde_Exception("No variable with name '" . $variableName . "' assigned to template.", 90019);
     }
     $contents = (string) $parser->getTemplate()->getAssigned($variableName);
     /* @var $doc DOMDocument */
     $doc = $this->ownerDocument;
     $cdata = $doc->createCDATASection($contents);
     $this->appendChild($cdata);
 }
Esempio n. 2
0
 /**
  * 
  * @param DOMNode $node
  * @return Ajde_Component
  */
 public static function fromNode(Ajde_Template_Parser $parser, DOMNode $node)
 {
     $componentName = ucfirst(str_replace(self::AC_XMLNS . ':', '', $node->nodeName));
     $className = 'Ajde_Component_' . $componentName;
     $nodeAttributes = $node->attributes;
     $innerXml = $parser->innerXml($node);
     $attributes = array();
     foreach ($nodeAttributes as $attribute) {
         $attributes[$attribute->name] = $attribute->value;
     }
     return new $className($parser, $attributes, $innerXml);
 }