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

  • 相关阅读:
    整数数组中最大子数组的和有溢出如何处理
    返回一个整数数组(环形数组)中最大子数组的和
    cnblogs用户体验评价
    SCRUM报告(一)
    Spring冲刺计划会议
    Spring冲刺计划会议
    团队合作项目----冲刺目标确定
    结队开发
    组队开发----卖书问题
    团队开发---NABC分析
  • 原文地址:https://www.cnblogs.com/fengju/p/6174115.html
Copyright © 2011-2022 走看看