zoukankan      html  css  js  c++  java
  • smarty应用中fckeditor的方法

    1、写个函数create_html_editor

    <?
    require_once('fckeditor/fckeditor.php');
    function create_html_editor($input_name, $input_value = '' ,$sfckname='FCKeditor')
    {
        global $smarty;

        $editor = new FCKeditor($input_name) ;
        $editor->BasePath   = "fckeditor/";
        $editor->ToolbarSet = "Normal";
        $editor->Width      = "100%";
        $editor->Height     = "320";
        $editor->Value      = $input_value;
        $FCKeditor = $editor->createhtml();
        $smarty->assign($sfckname, $FCKeditor);
    }
    ?>

    实现模板操作。

    2、调用方法

    <?php
    require_once('class/fck_smarty.php');
    include_once('../libs/Smarty.class.php');   //包含smarty类文件
    $smarty= new Smarty;  //实例化Smarty类
    $smarty->template_dir= './templates';  //设置模板目录
    $smarty->compile_dir= './templates_c';      //设置编译目录
    $smarty->cache_dir= './cache';              //设定缓存目录
    $smarty->caching =  false;
    create_html_editor('fck', '我爱我家');
    $smarty->display('edit.tpl');
    ?>

    3、存储文本传过来的内容

    edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', is_open='$_POST[is_open]', author='$_POST[author]', author_email='$_POST[author_email]', keywords ='$_POST[keywords]', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1]', link='$_POST[link_url]' ", $_POST['id'])

    这就是smarty 应用FCKeditor的一般方法.

    -----------------------------------------------------------------------------------------技术交流群:37304662

    本群主要交流技术为:PHP,CGI,SQL,MYSQL等Web编程相关技术、数据库.

  • 相关阅读:
    osworkflow
    用Flash做报表,推荐使用Flash饼图
    ANT 发布项目中 build.xml 文件的详细配置
    tomcat 修改java后不重启的方法
    工厂方法(Factory Method)模式
    NSRunLoop概述和原理
    使用NSOperationQueue简化多线程开发
    使用Grad Central Dispatch简化iPhone开发
    进度显示例子学习
    深入浅出 iOS 之多线程
  • 原文地址:https://www.cnblogs.com/fengju/p/6174115.html
Copyright © 2011-2022 走看看