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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值