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

  • 相关阅读:
    UnityGUI Keynote
    Unity3D Asset 导入&导出
    Unity3d平台信息设置
    Unity3D自带Demo AngryBots路径
    如何判定Unity已破解成功
    fbx模型
    Init & Deinit & ARC
    Subscript & Inheritance
    Properties & Method
    Enumeration & Class & Structure
  • 原文地址:https://www.cnblogs.com/fengju/p/6174115.html
Copyright © 2011-2022 走看看