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']);然后在这句下面写:
        //参数解Da 第一个:字段名称  第二个:输出文本框名称:第三个:数据
        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,大功告成,直接预览就可以了!

转载于:https://my.oschina.net/u/914487/blog/672859

ecshop更换百度ueditor插件相关信息如下: ecshop版本:ecshop2.7.3 编码格式:UTF-8 ueditor版本:1.4.3 1、打开admin/includes/lib_main.php文件 (1)找到:(大约在306-323行左右) /** * 生成编辑器 * @param string input_name 输入框名称 * @param string input_value 输入框值 */ 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); } 将这段代码修改为: /** * 生成编辑器 * @param string input_name 输入框名称 * @param string input_value 输入框值 */ 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); } 将这段代码修改为: /** * 生成编辑器 * @param string input_name 输入框名称 * @param string input_value 输入框值 */ function create_html_editor($input_name, $input_value = '') { global $smarty; $kindeditor=" <script id='editor' name='$input_name' type='text/plain' style='width:100%;height:500px;'>$input_value</script> <script type='text/javascript' charset='utf-8' src='../includes/ueditor/ueditor.config.js'></script> <script type='text/javascript' charset='utf-8' src='../includes/ueditor/ueditor.all.min.js'> </script> <script type='text/javascript' charset='utf-8' src='../includes/ueditor/lang/zh-cn/zh-cn.js'></script> <script> var ue = UE.getEditor('editor'); UE.getEditor('editor').focus(); </script> "; $smarty->assign('FCKeditor', $k
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值