Home >Backend Development >PHP Tutorial >ECSHOP backend development module steps_PHP tutorial
ECSHOP backend development module steps
1. Build database
2. Add it to the background navigation bar and configure relevant language packs
3. Permission configuration
4. Add, add, delete, check and modify
5. Add other functions (copy, search (the page cannot be brought up temporarily), sorting, transfer, AJAX)
The following is an example of adding a payment information module:
In the first step, we use phpmyadmin to build a payment table to store payment-related data information.
The second step is to add to the left navigation bar of the background and configure permissions and related language packages. Modify four files inc_priv.php, inc_menu.php, priv_action.php and common.php in total
1. Open languageszh_cnadmincommon.php, find /* menu classification part */ add:
$_LANG['18_pay'] = '支付管理';
Also add:
at the end of the file/* 支付管理 */ $_LANG['02_pay_list'] = '支付人信息'; $_LANG['03_pay_charge'] = '账户充值'; $_LANG['04_pay_record'] = '流水记账';
2. Open adminincludesinc_menu.php and add:
at the end$modules['18_pay']['02_pay_list'] = 'pay.php?act=list'; $modules['18_pay']['03_pay_charge'] = 'pay.php?act=charge'; $modules['18_pay']['04_pay_record'] = 'pay.php?act=record';
OK, the menu bar displays
The third step is to configure the permission system (involving files: priv_action.php, inc_priv.php)
1. Insert data pay, pay_manage, pay_drop into the table ecs_admin_action.
Note that parent_id = 0 is the top-level column, and the operations of other sub-columns inherit the parent_id and are associated with the top-level column (note the relationship between action_id and parent_id). For example, if you add a top-level column pay, the action_id is 136, and the parent_id is 0; then the parent_id of its sub-columns pay_manage and pay_drop are both 136;
2. Open languageszh_cnadminpriv_action.php and add:
$_LANG['pay'] = '支付管理';
At the end of the file add:
//支付管理 $_LANG['pay_manage'] = '支付添加/编辑'; $_LANG['pay_drop'] = '支付删除';
3.打开admin\includes\inc_priv.php,在文件末尾添加:
//支付管理 $purview['02_pay_info'] = array('pay_manage', 'pay_drop'); $purview['03_pay_charge'] = 'pay_manage'; $purview['04_pay_record'] = 'pay_manage';
The fourth step is to add basic add, delete, modify and check functions, create four files pay.php, pay_list, pay_info, pay_search, and add the "Add" function
/*------------------------------------------------------ */ //-- 添加支付人信息 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'add') { /* 权限判断 */ // admin_priv('pay_manage'); } /*------------------------------------------------------ */ //-- 添加支付人信息 /*------------------------------------------------------ */ if ($_REQUEST['act'] == 'insert') { /* 权限判断 */ //admin_priv('pay_manage'); admin_log($_POST['pay_id'],'add','exchange_goods'); clear_cache_files(); // 清除相关的缓存文件 sys_msg($_LANG['articleadd_succeed'],0, $link); }
Note: The admin_priv function determines whether it has permissions