以下是PHP程序<?php
require_once("conn_inc.php");
require_once("smarty_inc.php");
if ($_REQUEST['id']) {
$id=$_REQUEST['id'];
$query=mysql_query("select * from new where id='$id' ");
$row=@mysql_fetch_array($query);
$content=$row['content'];
}
$smarty->assign("content",$content);
$smarty->display("new_update.tpl.html");
?>以下是模板程序<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<form action="" method="POST">
<table border="1" align="center" width="70%">
<tr>
<td>内容:</td>
<td>
{literal}
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'content' ) ;
oFCKeditor.BasePath = "fckeditor/" ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = "{$content}" ;
oFCKeditor.Create() ;
</script>
{/literal}
</td>
</tr>
<tr>
<td colspan="2"><center><input name="submit" value="更新提交" type="submit"></center></td>
</tr>
</table>
</form>
当我通过
$smarty->assign("content",$content);
把值传送给模板变量{$content}的时候在模板页面中不显示
当我查看原程序的时候发现
oFCKeditor.Value = "{$content}" ; 中对以的有值,大家看下我哪里写错了!
require_once("conn_inc.php");
require_once("smarty_inc.php");
if ($_REQUEST['id']) {
$id=$_REQUEST['id'];
$query=mysql_query("select * from new where id='$id' ");
$row=@mysql_fetch_array($query);
$content=$row['content'];
}
$smarty->assign("content",$content);
$smarty->display("new_update.tpl.html");
?>以下是模板程序<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<form action="" method="POST">
<table border="1" align="center" width="70%">
<tr>
<td>内容:</td>
<td>
{literal}
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'content' ) ;
oFCKeditor.BasePath = "fckeditor/" ;
oFCKeditor.Height = 300 ;
oFCKeditor.Value = "{$content}" ;
oFCKeditor.Create() ;
</script>
{/literal}
</td>
</tr>
<tr>
<td colspan="2"><center><input name="submit" value="更新提交" type="submit"></center></td>
</tr>
</table>
</form>
当我通过
$smarty->assign("content",$content);
把值传送给模板变量{$content}的时候在模板页面中不显示
当我查看原程序的时候发现
oFCKeditor.Value = "{$content}" ; 中对以的有值,大家看下我哪里写错了!
{/literal}
用了这个标签,不支持变成输出!
问题应该就出现在{literal}
{$content}就不被编译了。看看这样如何:<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="fckeditor/fckeditor.js"></script>
<form action="" method="POST">
<table border="1" align="center" width="70%">
<tr>
<td>内容:</td>
<td>
{literal}
<script type="text/javascript">
var oFCKeditor = new FCKeditor( 'content' ) ;
oFCKeditor.BasePath = "fckeditor/" ;
oFCKeditor.Height = 300 ;
{/literal}
oFCKeditor.Value = "{$content}" ;
{literal}
oFCKeditor.Create() ;
</script>
{/literal}
</td>
</tr>
<tr>
<td colspan="2"><center><input name="submit" value="更新提交" type="submit"></center></td>
</tr>
</table>
</form>