使用php和javascript将wiki转换为html


Pulling wiki to html using php and javascript

我想使用这里提到的这些技术将wiki语法更改为html。

http://www.ladyada.net/library/software/wiki.html

这是我的php页面的源代码,似乎工作得很好。你可以这样试试:

http://temelelektronik.net/wiki/show.php?id=test

<?
if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
require_once(DOKU_INC.'inc/init.php');
require_once(DOKU_INC.'inc/common.php');
require_once(DOKU_INC.'inc/events.php');
require_once(DOKU_INC.'inc/pageutils.php');
require_once(DOKU_INC.'inc/html.php');
require_once(DOKU_INC.'inc/auth.php');
require_once(DOKU_INC.'inc/actions.php');
//import variables
$QUERY = trim($_REQUEST['id']);
$ID = getID();
$REV = $_REQUEST['rev'];
$HIGH = $_REQUEST['s'];
if(empty($HIGH)) $HIGH = getGoogleQuery();
//sanitize revision
$REV = preg_replace('/[^0-9]/','',$REV);
$html = p_wiki_xhtml($ID,$REV,true);
$html = addslashes($html);
$html = ereg_replace("'n", ''n'."'''n", $html);
$html = str_replace("</a>", "</a> ", $html);
echo ('var zoomy = "'.$html.'";');
echo ("document.write(zoomy);");
$url = "http://www.temelelektronik.net/wiki/" . str_replace(':', '/', $_REQUEST['id']);
$footer = '<hr /><br /><em>This page was autogenerated from
<a href='"'.$url.''" target='"_blank'">' . $url . '</a> <br />Please edit the wiki to contribute any updates or corrections.</em>';
$footer = '"' . $footer . '"';
echo ('document.write('. $footer . ')');
?>

但是当我将这个Javascript代码添加到一个空白的html页面时,我什么也看不到。这是HTML文件。

<html>
<head>
<script language="Javascript" src="/show.php?id=test"></script>
</head>
<body>  
</body>
</html>

你会看到它什么也没显示。

http://temelelektronik.net/wiki/test.html

如何解决这个问题?你能给予的任何帮助我们都会非常感激。谢谢. .

因为您提供了错误的URL?

http://temelelektronik.net/wiki/show.php?id=test

<script language="Javascript" src="/show.php?id=test"></script>

显然应该是/wiki/show.php?div id =测试