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