How to Export Wiki Page as HTML
This is kind of experimental.
Make a link to tiki-print.php?page=PageName&display=html
Index: tiki-print.php =================================================================== --- tiki-print.php (revision 35826) +++ tiki-print.php (working copy) @@ -92,6 +92,29 @@ header('Content-Length: '. strlen($pdf)); echo $pdf; +} elseif (isset($_REQUEST['display']) && $_REQUEST['display'] == 'html') { + $output = $smarty->fetch('tiki-print.tpl'); + $output = rewriteRelative($output, $base_url); + header('Cache-Control: private, must-revalidate'); + header('Pragma: private'); + header('Content-disposition: attachment; filename="'. $page. '.html"'); + header("Content-Type: application/xhtml+xml"); + header('Content-Length: '. strlen($output)); + echo $output; } else { $smarty->display('tiki-print.tpl'); } + +function rewriteRelative($html, $base) { + + // generate server-only replacement for root-relative URLs + $server = preg_replace('@^([^\:]*)://([^/*]*)(/|$).*@', '\1://\2/', $base); + + // replace root-relative URLs + $html = preg_replace('@\<([^>]*) (href|src)="/([^"]*)"@i', '<\1 \2="' . $server . '\3"', $html); + + // replace base-relative URLs (kludgy, but I couldn't get ! to work) + $html = preg_replace('@\<([^>]*) (href|src)="(([^\:"])*|([^"]*:[^/"].*))"@i', '<\1 \2="' . $base . '\3"', $html); + return $html; + +}