Home  >  Article  >  Backend Development  >  How to copy a new module in destoon_PHP tutorial

How to copy a new module in destoon_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:24:30852browse

During the actual use of destoon, we often need to create some modules that the system does not have according to the situation. At this time, we need to copy the existing modules to create new modules based on the existing modules. The specific operation method is as follows:

First select a module we need (because the system default article and information modules can be copied, here we only study how to copy non-default modules), I chose the module name is brand, and the directory name is brand. The module ID is 13, you can also choose the module to copy according to your needs.

The first step is to copy the brand folder in the root directory, paste it and rename it . Here we use rename as an example. So there is an additional folder named rename in your root directory. Let’s open this folder and find the file config.inc.php. After opening it, it reads like this

<&#63;php
$moduleid = 13;
&#63;>

Change the 13 here to a number that is not in your current module ID. We will replace it with 88 as an example.

The second step is to find the /module folder in the root directory and open it, copy the brand folder inside, paste it and rename it to rename, open admin/config.inc in this new folder .php file, the file inside is like this (comments have been added here for ease of understanding)

<&#63;php
defined(‘IN_DESTOON') or exit(‘Access Denied');
$MCFG['module'] = ‘brand';//这里改为 ‘rename';
$MCFG['name'] = ‘品牌';//这里改为你的新模块名比如: ‘新模块';
$MCFG['author'] = ‘Destoon.COM';
$MCFG['homepage'] = ‘www.destoon.com';
$MCFG['copy'] = false;//这里改为true;
$MCFG['uninstall'] = true;
$MCFG['moduleid'] = 13;//这里改为88;
$RT = array();
$RT['file']['index'] = ‘品牌管理';
$RT['file']['html'] = ‘更新网页';
$RT['action']['index']['add'] = ‘添加品牌';
$RT['action']['index']['edit'] = ‘修改品牌';
$RT['action']['index']['delete'] = ‘删除品牌';
$RT['action']['index']['check'] = ‘审核品牌';
$RT['action']['index']['expire'] = ‘过期品牌';
$RT['action']['index']['reject'] = ‘未通过品牌';
$RT['action']['index']['recycle'] = ‘回收站';
$RT['action']['index']['move'] = ‘移动品牌';
$RT['action']['index']['level'] = ‘品牌级别';
$CT = true;
&#63;>

Replace all the brands here with your new module name such as: 'New Module', make corresponding modifications according to the comments and save, then open the html.inc.php file in the same directory at about 65 and Found on line 66

if($update) {
require MD_ROOT.'/brand.class.php';
$do = new brand($moduleid);
}

Replace the two brands with rename and save, then open the index.inc.php file in the same directory and find

on the third line.
require MD_ROOT.'/brand.class.php';
$do = new brand($moduleid);

Similarly replace these two brands with rename and save, OK, find the my.inc.php file in the upper directory (root directory/module/rename), use the editor's replacement function to replace all brands with rename Save, then open the file brand.class.php in the same directory. Also use the editor's replacement function to replace all brands with rename and save it as (note that it is saved as) rename.class.php.

The third step is to find your template path (the default is the root directory/template/default), copy and paste the brand folder, rename it to rename, and then open the member folder in the same directory to find it The file my_brand.htm is copied and pasted and renamed to my_rename.htm.

After completing the above three steps, the code of our copy module is basically completed. The next step is to copy the database. Find the two tables destoon_brand and destoon_brand_data in the database, and copy them again. Named destoon_rename and destoon_rename_data, (if the database is running, you may need to pause and perform the above operations)

OK, log in to the backend after completion, select Add Module in My Panel-"Module Management, and then fill in the module name such as: "New Module". In the drop-down option of the model to which it belongs, you will find an additional one named "New module" option, select it, fill in rename in the installation directory, and click OK. Then go to the function module to see if there is an additional function module named "New Module"? If it appears, it means there is no problem with the operation you just performed. Congratulations, the module has been added. But when you are immersed in joy and eager to add data to the new module, you find that the page is blank. Why is this? The reason is that there is an information sorting method in the module settings. Just choose one here and fill in the list or search main field below. After filling in, click OK and try adding it again to see if it can be used. Already?

Another problem encountered during actual use is that when the added module is used in the member center, it prompts that there is no permission. Please upgrade. I checked the background member group permission to publish information and the permission has been checked. Why? Still getting a message about insufficient permissions? The solution is to find the file /module/member/admin/template/group_edit.tpl.php in the root directory and find the following code at about line 762

</tr>
<tr>
<td class=”tl”>发布下载总数限制</td>
<td>
<input type=”text” name=”setting[down_limit]” size=”5″ value=”<&#63;php echo $down_limit;&#63;>”/>
</td>
</tr>
<tr>
<td class=”tl”>免费发布新模块数量</td>
<td>
<input type=”text” name=”setting[down_free_limit]” size=”5″ value=”<&#63;php echo $down_free_limit;&#63;>”/>
</td>
</tr>

changed to:

</tr>
<tr>
<td class=”tl”>发布新模块总数限制</td>
<td>
<input type=”text” name=”setting[rename_limit]” size=”5″ value=”<&#63;php echo $rename_limit;&#63;>”/>
</td>
</tr>
<tr>
<td class=”tl”>免费发布下载数量</td>
<td>
<input type=”text” name=”setting[rename_free_limit]” size=”5″ value=”<&#63;php echo $rename_free_limit;&#63;>”/>
</td>
</tr>

Copy this modified code and place it under the code you found earlier. Save and refresh, then go to the settings to check. There are two more input boxes that need to be filled in at the bottom. Fill in the relevant numbers and click OK. . OK, now members can use the new module.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/825468.htmlTechArticleIn the actual use of destoon, we often need to create some modules that the system does not have according to the situation. At this time, we need to copy Existing modules to create new modules based on existing modules, with...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn