This article describes how to copy new modules in destoon. You can create modules that are not available in the destoon process, for more information, see destoon's actual use process. We often need to create modules that are not available in the system as needed. At this time, we need to copy existing modules to create new modules based on existing modules, the procedure is as follows:
First, select a required module (because the system's default articles and information modules can be copied, Here we only study how to copy non-default modules ), the module name is brand, the directory name is brand, and the module ID is 13. You can also select the module to be copied as needed.
Step 1: copy the brand folder under the root directory, paste it, and rename it.In this example, rename is used. The root directory contains a folder named rename. Open this folder and find the file config. inc. php.
<?php$moduleid = 13;?>
Change "13" here to a number that you do not have in the current module ID. We will use "88" as an example.
Step 2: Find the/module folder under the root directory to open it, copy the brand folder, paste it, and rename it.For rename, open the admin/config. inc. php file in this new folder. The file in this folder is as follows (for ease of understanding, annotations are added here)
<? Phpdefined ('in _ DESTOON ') or exit ('Access Denied'); $ MCFG ['module'] = 'brand'; // change it to 'rename' here '; $ MCFG ['name'] = 'brand'; // change the name of your new module here, for example, 'new module'; $ MCFG ['author'] = 'deston. COM '; $ MCFG ['homepage'] = 'www .destoon.com'; $ MCFG ['copy'] = false; // change it to true here; $ MCFG ['uninstall'] = true; $ MCFG ['leleid'] = 13; // change it to 88 here; $ RT = array (); $ RT ['file'] ['index'] = 'brand management'; $ RT ['file'] ['html '] = 'Update page '; $ RT ['action'] ['index'] ['add'] = 'Add a brand'; $ RT ['action'] ['index'] ['edit'] = 'modify A brand '; $ RT ['action'] ['index'] ['delete'] = 'delete brands '; $ RT ['action'] ['index'] ['check'] = 'brand review '; $ RT ['action'] ['index'] ['expire '] = 'Expired brands '; $ RT ['action'] ['index'] ['reobject'] = 'failed brands '; $ RT ['action'] ['index'] ['recycle'] = 'recycle bin '; $ RT ['action'] ['index'] ['move '] = 'mobile brands '; $ RT ['action'] ['index'] ['level'] = 'brand level'; $ CT = true;?>
Replace all the brands here with your new module name, for example, 'new module'. Modify and save the new modules according to the annotations, and then open the html in the directory of the same level. inc. php files are found in lines 65 and 66.
if($update) {require MD_ROOT.'/brand.class.php';$do = new brand($moduleid);}
Replace the two brands with rename, save them, and then open the index. inc. php file in the directory of the same level.
require MD_ROOT.'/brand.class.php';$do = new brand($moduleid);
Replace these two brands with rename and save them. OK, find my in the parent directory (root directory/module/rename. inc. php file, replace all brands with rename with the replacement function of the editor, save the file, and then open the brand under the same level directory. class. in php, replace all brands with rename using the replacement function of the editor and save it as (note that it is saved as) rename. class. php.
Step 3: Find your template path (default: root directory/template/default), copy and paste the brand folder, and rename it..
After completing the above three steps, we have basically completed the code of the copy module. The next step isCopy DatabaseFind the destoon_brand and destoon_brand_data tables in the database and rename them as destoon_rename and destoon_rename_data. (If the database is running, you may need to suspend the database and perform the above operations)
OK. After that, log on to the backend and choose "add module" in "My panel>" module Management ". Then, enter the module name, for example," new module ", in the drop-down list of the model, you will find an option named "new module". Select it, enter rename in the installation directory, and click OK. Then go to the function module to see if a function module named "new module" has been added? If yes, it means that your operation is correct. Congratulations, the module has been added. But when you are immersed in joy and eager to add data to the new module, the page is blank. Why? The reason is that there is an information sorting method in the Module Settings. You can select one here. By the way, enter the following list or search main field. After filling in the list, click OK, try again to add it, can it be used?
During actual use, another problem occurs: the added module prompts you that you do not have permission when using it in the member center. Please upgrade it, I checked the permissions for publishing information for the background member group. Why do I still prompt that the permissions are insufficient? The solution is to find the root directory/module/member/admin/template/group_edit.tpl.php and find the following code in around 762 lines.
Total number of published downloads"/>Number of new modules released for free"/>
Changed:
Total number of new modules released"/>Number of free release downloads"/>
Copy the modified Code under the code found above, save it, refresh it, and check it in settings. At the bottom, add two input boxes to be filled in and enter relevant numbers, click OK. OK. Now members can use the new module.