function prepareXMLFromTemplate( $templateName, $cli = false ) { $template = 'design:' . $templateName . '.tpl'; $tpl = eZTemplate::factory(); $tpl->setVariable( 'tpl_info', false ); $content = $tpl->fetch( $template ); $tplInfo = false; if ( $tpl->variable( "tpl_info" ) !== false ) { $tplInfo = $tpl->variable( "tpl_info" ); } if ( is_array( $tplInfo ) ) { foreach ( $tplInfo as $var => $info ) { if ( isset( $info['info'] ) ) { $query = $info['info']; } else { $query = 'Info for ' . $var; } $default = ''; if ( isset( $info['default'] ) ) { $default = $info['default']; } $value = eZPrepareXML::getUserInput( "Please enter \"" . $query . "\" (" . $default . "): ", $default ); $tpl->setVariable( $var, $value ); } } $content = $tpl->fetch( $template ); $xml = $tpl->variable( "xml_data" ); return $xml; }