How to copy a new module in destoon_PHP tutorial
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
<?php $moduleid = 13; ?>
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)
<?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; ?>
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=”<?php echo $down_limit;?>”/> </td> </tr> <tr> <td class=”tl”>免费发布新模块数量</td> <td> <input type=”text” name=”setting[down_free_limit]” size=”5″ value=”<?php echo $down_free_limit;?>”/> </td> </tr>
changed to:
</tr> <tr> <td class=”tl”>发布新模块总数限制</td> <td> <input type=”text” name=”setting[rename_limit]” size=”5″ value=”<?php echo $rename_limit;?>”/> </td> </tr> <tr> <td class=”tl”>免费发布下载数量</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 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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Long URLs, often cluttered with keywords and tracking parameters, can deter visitors. A URL shortening script offers a solution, creating concise links ideal for social media and other platforms. These scripts are valuable for individual websites a

Following its high-profile acquisition by Facebook in 2012, Instagram adopted two sets of APIs for third-party use. These are the Instagram Graph API and the Instagram Basic Display API.As a developer building an app that requires information from a

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

The 2025 PHP Landscape Survey investigates current PHP development trends. It explores framework usage, deployment methods, and challenges, aiming to provide insights for developers and businesses. The survey anticipates growth in modern PHP versio
