function t2js($content)
{
return str_replace(array("\r", "\n"), array('', '\n'), addslashes($content));
}
[b][color=red]例如要将ecshop的历史浏览改成js版本,则可以这样[/color][/b]
新建一个文件jshistory.php
define('IN_ECS', true);
require(dirname(__FILE__) . '/includes/init.php');
assign_template();
$htmlcontent = $smarty->make_html("jshistory.dwt");
echo "document.write('".t2js($htmlcontent)."');";
function t2js($content)
{
return str_replace(array("\r", "\n"), array('', '\n'), addslashes($content));
}
新建一个jshistory.dwt
<!-- #BeginLibraryItem "/library/history.lbi" --><!-- #EndLibraryItem -->
调用的时候就可以这样
<script src="http://www.7xigu.com/jshistory.php" language="javascript" type="text/javascript"></script>