destoon Method for Copying New Modules

  • 2021-07-02 23:46:52
  • OfStack

In the actual use of destoon, we often need to establish some modules that the system does not have according to the situation. At this time, we need to copy the existing modules to establish new modules according to the existing modules. The specific operation methods are as follows:

First of all, choose a module we need (because the system default articles and information modules can be copied, here we only study how to copy non-default modules). I chose the module name as brand, the directory name as brand, and the module ID as 13. You can also choose the module to be copied according to your needs.

Step 1: Copy the brand folder under the root directory, paste it and rename it. Here we use rename naming as an example. So you have a folder named rename in your root directory. We open this folder and find the file config. inc. php. After opening it, it reads as follows


<?php
$moduleid = 13;
?>

Change the 13 here to a number that you don't have in the ID now, and let's replace it with 88 as a demonstration.

Step 2: Find the folder/module under the root directory and open it. Copy the brand folder inside, paste it and rename it as rename. Open the file admin/config. inc. php in this new folder. The file inside is like this (for convenience of understanding, comments are added here)


<?php
defined( ' IN_DESTOON') or exit( ' Access Denied');
$MCFG['module'] =  ' brand';// Replace here with   ' rename';
$MCFG['name'] =  'Brand ';// Change your new module name here, such as:   'New module ';
$MCFG['author'] =  ' Destoon.COM';
$MCFG['homepage'] =  ' www.destoon.com';
$MCFG['copy'] = false;// Replace here with true;
$MCFG['uninstall'] = true;
$MCFG['moduleid'] = 13;// Replace here with 88;
$RT = array();
$RT['file']['index'] =  'Brand management ';
$RT['file']['html'] =  'Update Web page ';
$RT['action']['index']['add'] =  'Add Branding ';
$RT['action']['index']['edit'] =  'Modify the brand ';
$RT['action']['index']['delete'] =  'Delete brand ';
$RT['action']['index']['check'] =  'Audit brand ';
$RT['action']['index']['expire'] =  'Expired brand ';
$RT['action']['index']['reject'] =  'Failed to pass the brand ';
$RT['action']['index']['recycle'] =  'Recycle bin ';
$RT['action']['index']['move'] =  'Mobile brand ';
$RT['action']['index']['level'] =  'Brand level ';
$CT = true;
?>

Replace all the brands here with your new module name, such as' New Module ', modify it according to the comments, save it, and then open the file html. inc. php 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 rename and save it, then open the file index. inc. php in the sibling directory and find it in roughly line 3


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

Replace these two brand with rename and save them, OK, find the file my. ES50php in the parent directory (root direction/module/rename), replace all brand with rename and save it, and then open the file brand. class. php in the same directory. Replace all brand with rename and save as (note save as) rename. ES60php.

Step 3: Find your template path (the default is root direction/template/default), copy the brand folder, paste it and rename it as rename, then open the member folder in the same directory to find the file my_brand. htm, copy and paste it and rename it as my_rename. htm.

After completing the above three steps, the code aspect of our replication module road is basically completed. The next step is to replicate the database, find the two tables destoon_brand and destoon_brand_data in the database, and rename them to destoon_rename and destoon_rename_data after replication. (If the database is running, you may need to suspend the above operations.)

OK, log in to the background 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, you will find an extra option named" New Module ". Select it, fill in rename in the installation directory, and click OK. Then go to the functional module to see if there is an extra functional module named "New Module". If it appears, it means that there is no problem with the operation you just did. Congratulations on the completion of adding the module. But when you are in the mood to add data to the new module, you find that the page is blank. Why? The reason is that there is an information sorting way in the module settings. Choose one here casually. By the way, fill in the following list or search main field. After filling it out, click OK, and then try to add it. Is it possible to use it?

There is also a problem in the actual use process, that is, when the added module is used in the member center, it prompts that there is no permission. Please upgrade and see that the permission of the background member group to publish information has been checked. Why does it prompt that the permission is not enough? The workaround is to find the root directory /module/member/admin/template/group_edit. tpl. php and find the following code on approximately line 762


</tr>
<tr>
<td class= " tl " > Total Publish Download Limit </td>
<td>
<input type= " text "  name= " setting[down_limit] "  size= " 5 "  value= " <?php echo $down_limit;?> " />
</td>
</tr>
<tr>
<td class= " tl " > Number of new modules released free of charge </td>
<td>
<input type= " text "  name= " setting[down_free_limit] "  size= " 5 "  value= " <?php echo $down_free_limit;?> " />
</td>
</tr>

Replace with the following:


</tr>
<tr>
<td class= " tl " > Total number of new modules published limit </td>
<td>
<input type= " text "  name= " setting[rename_limit] "  size= " 5 "  value= " <?php echo $rename_limit;?> " />
</td>
</tr>
<tr>
<td class= " tl " > Number of free releases and downloads </td>
<td>
<input type= " text "  name= " setting[rename_free_limit] "  size= " 5 "  value= " <?php echo $rename_free_limit;?> " />
</td>
</tr>

Copy this modified code and put it under the code found in front, save it and refresh it, and then go to the settings to see 1. At the bottom, there are two more input boxes that need to be filled in, fill in relevant numbers, and click OK. OK, where members can use the new module.


Related articles: