Home Backend Development PHP Tutorial How to copy a new module in destoon_PHP tutorial

How to copy a new module in destoon_PHP tutorial

Jul 13, 2016 am 10:24 AM

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;>

Copy after login

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;>

Copy after login

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);
}

Copy after login

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);

Copy after login

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>

Copy after login

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 after login

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 of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

11 Best PHP URL Shortener Scripts (Free and Premium) 11 Best PHP URL Shortener Scripts (Free and Premium) Mar 03, 2025 am 10:49 AM

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

Introduction to the Instagram API Introduction to the Instagram API Mar 02, 2025 am 09:32 AM

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

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

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-

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

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

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

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' =>

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

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.

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

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

Announcement of 2025 PHP Situation Survey Announcement of 2025 PHP Situation Survey Mar 03, 2025 pm 04:20 PM

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

See all articles