Destoon the method of copying new module _php instance

Source: Internet
Author: User
Tags parent directory

Destoon in the actual use of the process we often need to build some of the system does not have the module, this time it is necessary to replicate existing modules to build new modules according to the existing modules, the specific operation methods are as follows:

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

The first step is to copy the brand folder under the root directory, paste and then Rename, and here we use the rename name as a demonstration. So your root directory more than a name called Rename folder, we open this folder, find This file, open the inside is so written

$moduleid =;
? >

Change the 13 here to a number you don't have in the module ID, and we'll use 88 instead of it as a demonstration.

The second step, find the root directory/module this folder open, copy inside the brand folder, paste after renaming to rename, open this new folder in the admin/ This file, the file inside is like this (for easy understanding, add a note here)

defined (' In_destoon ') or exit (' Access Denied ');
$MCFG [' module '] = ' brand ';//here changed to ' rename ';
$MCFG [' name '] = ' brand ';//Here is your new module name: ' New module ';
$MCFG [' author '] = ' ';
$MCFG [' homepage '] = ' ';
$MCFG [' copy '] = false;//here instead of true;
$MCFG [' uninstall '] = true;
$MCFG [' moduleid '] = 13;//here instead;
$RT = Array ();
$RT [' file '] [' index '] = ' brand management ';
$RT [' file '] [' html '] = ' update Web page ';
$RT [' Action '] [' index '] [' add '] = ' Add brand ';
$RT [' Action '] [' index '] [' edit '] = ' modify brand ';
$RT [' Action '] [' index '] [' delete '] = ' delete brand ';
$RT [' Action '] [' index '] [' check '] = ' audit brand ';
$RT [' Action '] [' index '] [' expire '] = ' expired brand ';
$RT [' Action '] [' index '] [' reject '] = ' failed brand ';
$RT [' Action '] [' index '] [' recycle '] = ' Recycle Bin ';
$RT [' Action '] [' index '] [' move '] = ' mobile brand ';
$RT [' Action '] [' index '] [' level '] = ' brand ';
$CT = true;
? >

Replace the brand here with your new module name, such as: ' New module ', and save it according to the annotation, then open the in the sibling directory. This file is found in about 65 and 66 lines.

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

Replace the two brand with the rename, and then open the file in the same sibling directory, and find it in the third line.

Require Md_root. ' /brand.class.php ';
$do = new Brand ($moduleid);

Also replace these two brand with rename, OK, find the parent directory (root/module/ Rename) This file, replace all brand with the editor with rename, and then open the brand.class.php file in the same level directory, and replace all brand with the editor's replacement function as the rename (note Save As ) rename.class.php.

step three, find your template path (the default is root/template/default) Copy brand folder after pasting to rename, and then open the member folder under the sibling directory to find My_ brand.htm this file, copy and paste it and rename it to my_rename.htm.

Finish the above three steps, our copy module road code aspects of the basic completion, then is to copy the database , find the database Destoon_brand and destoon_brand_data These two tables, after the replication renamed to Destoon_ Rename and Destoon_rename_data, (if the database is running, you may need to pause to perform the above actions)

OK, after completion login backstage, in My panel-"module management inside choose to add modules, then fill in the module name such as:" New module ", in the subordinate model of the Drop-down option you will find out a" new module "option, select it, in the installation directory to fill in the rename, click OK. And then go to the function module to see if there is a feature module called "New module"? If it appears, you have no problem with the operation, congratulations, the module has been added to complete. But you're immersed in joy. Eager to add data to the new module when you find that the page is blank, why is this? The reason is that in the module setup has a sort of information in the way, here casually choose one, by the way the following list or search the main field also fill it, fill in after the point of determination, and then try to add is not to be used?

The actual use of the process will also encounter a problem, that is, the addition of this module in the Member Center when the prompt does not have permission, please upgrade, to see the background member group permissions to publish information has been checked, why also prompted insufficient permissions? The solution is to find the root directory/module/member/admin/template/group_edit.tpl.php this file and find the following code in about 762 lines

<td class= "tl" > Release download total limit </td>
<input type= "text" Name= "Setting[down_limit]" size= "5″value=" <?php echo $down _limit;? > "/>
<td class=" TL > Free new module quantity </td>
<input type= "text" Name= "Setting[down_free_limit]" size= "5″value=" <?php Echo $down _free_limit ;? > "/>


<td class= "TL" > Release new module total limit </td>
<input type= "text "Name=" Setting[rename_limit] "size=" 5″value= "<?php echo $rename _limit;? > "/>
<td class=" tl "> Free download quantity </td>
< td>
<input type= "text" name= "Setting[rename_free_limit" size= "5″value=" <?php Echo $rename _free_limit ;? > "/>

Copy this changed code in front of the code found in the following, save refresh, and then go to set the inside view, the bottom of the two more out of the need to fill in the input box, fill in the relevant numbers, point to determine. OK, the members will be able to use the new module.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.