/** * Calls the parent get_component_ref_code() method and writes it to the * compiled template, appending an add_child() method used to create * this component at runtime */ public function generateConstructor($code) { if (file_exists($this->runtime_component_path . '.class.php')) $code->registerInclude($this->runtime_component_path . '.class.php'); else throw new FileNotFoundException('run time component file not found', $this->runtime_component_path); $component_class_name = end(explode('/', $this->runtime_component_path)); if(!$component_class_name) throw new WactException('run time component file doesn\'t contains component class name', array('file_path' => $this->runtime_component_path)); $code->writePhp($this->parent->getComponentRefCode() . '->add_child(new ' . $component_class_name . '(), \'' . $this->getServerId() . '\');' . "\n"); parent::generateConstructor($code); }
/** * Results in all components registered as children of the instance of this * component having their generate() methods called */ public function generateNow($code) { return parent :: generate($code); }