PHPEye开源社区 » PHP周边技术讨论区 » SMARTY调用问题!
《Programming PHP》第二版上市
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>

2007-7-5 18:57 kylingood
搞定了。希望以后我能帮助别人。

2007-7-10 13:44 wps2000
应该是CreateHtml()吧!
然后assign啊什么的都没问题了

2007-7-14 18:24 Haohappy
这没什么特别的,这一部分应该是加在模板里的。

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]]

2008-4-27 06:36 stewen
版主怎么不把你的解决方法贴出来呢?共享一下嘛

2008-4-27 06:37 stewen
{php}
$editor=new FCKEditor();
......
{php}
是否是这样呢?

页: [1]
查看完整版本: SMARTY调用问题!


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.