function packen($filename, $wordtemplatedownloadpath, $temp_dir, $concontent, $stylecontent) { //global $filename, $wordtemplatedownloadpath; //write a new content.xml $handle = fopen($wordtemplatedownloadpath . '/' . $temp_dir . '/content.xml', "w"); fwrite($handle, $concontent); fclose($handle); //write a new styles.xml $handle2 = fopen($wordtemplatedownloadpath . '/' . $temp_dir . '/styles.xml', "w"); fwrite($handle2, $stylecontent); fclose($handle2); include_once 'vtlib/Vtiger/Zip.php'; $archive = new Vtiger_Zip($wordtemplatedownloadpath . '/' . $filename); //make a new archive (or .odt file) $archive->copyDirectoryFromDiskNoOffset($wordtemplatedownloadpath . $temp_dir); $archive->save(); }