2007-7-5 16:37
kylingood
SMARTY调用问题!
本人想在一body.tpl模板中调用FCKeditor,不知道如何做。急~~~
我在的主页面是index.php如下:
<?php
require "main.php";
$smarty->assign("title", "首页");
//下面是运有FCK
include("fckeditor/fckeditor.php") ;
$oFCKeditor = new FCKeditor('FCKeditor1') ;
$oFCKeditor->BasePath = '../FCKeditor/';
$oFCKeditor->Value ='';
$oFCKeditor->Width='270';
$oFCKeditor->Height='120';
$oFCKeditor->Create();
$smarty->display('header.tpl'); //显示首页
$smarty->display('body.tpl'); //[color=Red]本人就是想在这body.tpl中把$oFCKeditor->Create();显示出来[/color] $smarty->display('footer.tpl'); //显示页脚
?>
在这个 body.tpl 模板中我要把FCK编辑器放在这个表单中如下:
<form action="text.php" method="post" >
<p >
<span class="liuyan">留言内容<span>
[color=Red]想把FCK编辑器放这里面。不知道有没朋友这样用过。希望能教教我,谢谢~!~~ [/color]
</p>
<input type="reset" id="upreset"name="Submit" value="重置" />
<input type="submit" id="sbutton" value="确定" />
</form>
2008-4-2 15:05
yangxiao42
写一个class
class Editor
{
/*
*函数:show
*作用:显示图文编辑器
*输入:$FormName(表单的名称),$FieldName(图文混排的字段),$Value(图文混排的值), $Where(在哪个部分使用的编辑框?),$Fid(论坛ID), $CommID(社区ID), $ClubID(俱乐部ID), $Type(使用哪个编辑器)
*输出:返回图文编辑器
**
******************************************
*--制作--日期--
*[email]KuaiYigang@xingmo.com[/email] 2004-12-12 19:26
******************************************
*--修改--日期--目的--
*
*/
function show($FieldName, $Value)
{
global $INC;
require_once $INC.'/FCKeditor/fckeditor.php';
$oFCKeditor = new FCKeditor($FieldName) ;
$oFCKeditor->BasePath = '/inc/FCKeditor/';
$oFCKeditor->Value = $Value;
$oFCKeditor->Height = '500';
$str = $oFCKeditor->Create() ;
return $str;
}
}
?>
只要在你php 里调用这个class
在html直接就可以传过来就是了
[[i] 本帖最后由 yangxiao42 于 2008-4-2 15:06 编辑 [/i]]