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编程相关技术、数据库.

  • 相关阅读:
    Nagios利用NSClient++监控Windows主机
    Nagios监控Windows的网卡流量
    Nagios 监控Windows服务器(详细篇)
    ODB学习笔记之基础环境搭建
    用Kindle阅读PDF最简单的3个方法!
    RocketMQ吐血总结
    RocketMQ使用
    掌握 analyze API,一举搞定 Elasticsearch 分词难题
    ElasticSearch5.3安装IK分词器并验证
    Kibana server is not ready yet出现的原因
  • 原文地址:https://www.cnblogs.com/fengju/p/6174115.html
Copyright © 2011-2022 走看看