/** * * @param code $ _writer * @return void * @access protected */ function generate_constructor(&$code) { $code->register_include(LIMB_DIR . $this->runtime_component_path . '.class.php'); $args = '__FILE__.\'' . $this->get_server_id() . '\''; isset($this->attributes['expires']) ? $args .= ',' . $this->attributes['expires'] . '' : ($args .= ',3600'); isset($this->attributes['cacheby']) ? $args .= ',\'' . $this->attributes['cacheby'] . '\'' : ($args .= ',\'\''); isset($this->attributes['cachegroup']) ? $args .= ',\'' . $this->attributes['cachegroup'] . '\'' : ($args .= ',false'); $component_class_name = end(explode('/', $this->runtime_component_path)); $code->write_php($this->parent->get_component_ref_code() . '->add_child(new ' . $component_class_name . '(' . $args . '), \'' . $this->get_server_id() . '\');'); compiler_component::generate_constructor($code); }
/** * 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 * * @param code $ _writer * @return string * @access protected */ function generate_constructor(&$code) { if (file_exists(PROJECT_DIR . $this->runtime_component_path . '.class.php')) { $code->register_include(PROJECT_DIR . $this->runtime_component_path . '.class.php'); } elseif (file_exists(LIMB_DIR . $this->runtime_component_path . '.class.php')) { $code->register_include(LIMB_DIR . $this->runtime_component_path . '.class.php'); } else { error('run time component file not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); } $component_class_name = end(explode('/', $this->runtime_component_path)); if (!$component_class_name) { error('empty component class name', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__); } $code->write_php($this->parent->get_component_ref_code() . '->add_child(new ' . $component_class_name . '(), \'' . $this->get_server_id() . '\');' . "\n"); parent::generate_constructor($code); }