找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 118|回复: 0

[cms教程] Ecshop后台商品添加一个新的FCK编辑器和字的详细介绍!

[复制链接]

该用户从未签到

发表于 2018-5-19 13:43:00 | 显示全部楼层 |阅读模式

您需要 登录 才可以下载或查看,没有账号?立即注册

×
Ecshop后台商品添加一个新的FCK编辑器和字的详细介绍!
1.在数据库 ecs_goods 这个表里面新建 你所需要的字段。例如(goods_xxx,goods_xxx1)
2.找到 admin/templates/goods_info.htm  这个文件。在相关地方加入你所需要的字段。按照他原来的文本框复制
  一个然后修改下名称就可以。
  如果是需要加入像商品描述用FCK编辑器的这种的话:
  他原来的是这样写的:{$FCKeditor}。找到admin/goods.php
  大约在420行就可以找到这个句代码:create_html_editor('goods_desc', $goods['goods_desc',);
  create_html_editor() 这个函数是在 admin/include/lib_main.php里面,大约在306行;
  他是这样写的:
function create_html_editor($input_name, $input_value = '')
{
    global $smarty;
    $editor = new FCKeditor($input_name);
    $editor->BasePath   = '../includes/fckeditor/';
    $editor->ToolbarSet = 'Normal';
    $editor->Width      = '100%';
    $editor->Height     = '320';
    $editor->Value      = $input_value;
    $FCKeditor = $editor->CreateHtml();
    $smarty->assign('FCKeditor', $FCKeditor);//这里输出了。
}
所以我们要用的话就不能写同一个了。就需要另外新建一个。
新建方法:在他下面加入一个函数 create_html_editor2
function create_html_editor2($input_name,$output_name,$input_value = '')
{
    global $smarty;
    $editor = new FCKeditor($input_name);
    $editor->BasePath   = '../includes/fckeditor/';
    $editor->ToolbarSet = 'Normal';
    $editor->Width      = '100%';
    $editor->Height     = '320';
    $editor->Value      = $input_value;
    $FCKeditor = $editor->CreateHtml();
    $smarty->assign($output_name,, $FCKeditor);//这里输出就用$output_name变量了。
}
  建好了,然后调用:
  找到admin/goods.php 大约在420行就可以找到这个句代码:create_html_editor('goods_desc', $goods
['goods_desc',);然后在这句下面写:
        //参数解答 第一个:字段名称  第二个:输出文本框名称:第三个:数据
        create_html_editor2('goods_xxx','goods_xxx' ,$goods['goods_xxx',);第一个字段
        create_html_editor2('goods_xxx1','goods_xxx1' ,$goods['goods_xxx1',);第2个字段
然后模版里面调用就很简单了:
找到 admin/templates/goods_info.htm  这个文件。在相关的地方加入:
比如我刚才新建的:直接调用就行了。
{$FCKeditor}
{$goods_xxx}
{$goods_xxx1}
好了,都就绪了  就是插入数据了。那很简单了。
找到 admin/goods.php这个页面
1.大约在161行加入:'goods_xxx'    => '',
2.大约在234行加入:'goods_xxx'    => '',
3.大约在843行加入字段:goods_xxx,
4.大约在849行加入字段值:'$_POST[goods_xxx,',
5.大约在857行加入字段:goods_xxx,
6.大约在863行加入字段值:'$_POST[goods_xxx,',
7.大约在927行加入:"goods_xxx = '$_POST[goods_xxx,', " .
OK,大功告成,直接预览就可以了!
回复

使用道具 举报

网站地图|页面地图|文字地图|Archiver|手机版|小黑屋|找资源 |网站地图

GMT+8, 2024-9-30 03:23

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表