editnews.tpl文件是一个编辑新闻的页面,,,我想在网页上显示原来的值:
.tpl文件:...省略...  <tr>
    <td height="25" bgcolor="#FFFFFF"><div align="right">内容</div></td>
    <td bgcolor="#FFFFFF"><label>
{assign var="rinfo" value="Bob"} {include_php file="fckeditor/fckeditor.php"}
{php}
$sBasePath ="fckeditor/";$oFCKeditor = new FCKeditor('info') ;
$oFCKeditor->BasePath = $sBasePath ;
$oFCKeditor->Config['AutoDetectLanguage'] = true ;
$oFCKeditor->Config['DefaultLanguage'] = 'en' ;$oFCKeditor->Value =$r["info"];//就是这里的值无法显示
$oFCKeditor->Height="200";
$oFCKeditor->Create() ;
{/php}
  
  
  
    </label></td>
  </tr>
  <tr>
    <td height="30" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF"><label>
      <input type="submit" name="Submit" value="提交">...省略...
----------------------------
而PHP中是这样取得数据:
$sql="select * from articles where articleid='".$id."'";
$result=mysql_query($sql) or die(mysql_error());
$r=mysql_fetch_array($result);
但$r["info"]就是无值显示!唉,,,苦恼

解决方案 »

  1.   

    $oFCKeditor->Value =$r["info"];
    $rs['info']=$oFCKeditor -> CreateHtml();
    $smarty -> assign('FCKeditor',$rs['ci_content']);然后在TPL文件中直接用 $FCKeditor就可以显示用了smarty怎么还要让PHP与HTML混写??楼主好好思考下..
      

  2.   

    $smarty -> assign('FCKeditor',$rs['ci_content']); 这里应该为$smarty -> assign('FCKeditor',$rs['info']); 粘的以前自己写的代码..弄错了..P.S.CSDN不能编辑自己的贴子...汗..
      

  3.   

    提醒下LZ 看看PHP编码规范 看着头大的字符串和变量混合