General Catalogue
- Plug-in directory structure (i)
- Admin Background page write (ii)
- Foreground template page Preparation (c)
- URL Rewriting (iv)
This example is intended to introduce a practical example of how to make a plugin in Dtcms, this series of articles is not an introductory tutorial, some of the logical implementation around the area, please understand.
The project requirement is to add an electronic resource management to the DTCMS and provide flexible screening methods.
Because the content is more involved, intends to be divided into 4 parts to describe, the content page is my own 1.1 points to find out, on the basis of the original development is the 3rd time, this time on the plug-in production further understanding, while through constant debugging to understand the URL rewrite rules.
Chapter Directory
- Plug-in directory structure
- Create a new plug-in project
- Settings for Plugin.config
First, the plug-in directory structure
First, the plug-in is placed in the Web root directory under the plugin directory, each directory in the plugin directory represents a plug-in, each plug-in at least contains the admin directory, bin directory, Templet directory, as well as a plugin.config file.
The built projects are as follows:
II. Create a new plugin Project 1. New Project
The first is to create a new class library project in VS, DTcms.Web.Plugin.DataBaseManager, located in the plugins directory of the Dtcms Web directory.
Then add the reference, first of all the references within the project, such as the BLL, common, DB, model, UI, and one more. Net of system.web
2. Modify the project folder name
In order to let Dtcms recognize this plugin, we need to change the folder name, then temporarily uninstall the plugin project, we need to go to the folder to change the folder name.
Rename this folder, called Databasemanager
And then add this item back,
3. Set Project Build Properties
Right-click Project-Properties-build, output path, mainly for the convenience of debugging, do not have to put the generated DLL every time in the web\bin\ directory.
4. Create a directory according to the rules
First we need the admin directory, the Templet directory, the new directory is relatively simple, the more troublesome is to create a new Web page, because we are a class library project, cannot create a new ASPX page, the latter need to use the ASPX page, so we copy an ASPX page from somewhere else.
Then you need to modify the class name
ASPX page:
Aspx.cs file:
Aspx.designer.cs file
Then delete all the error codes, because we have to rewrite them.
At this point we have all the projects set up.
Third, the setting of Plugin.config
In order to allow DTCMS backstage to recognize the plugin, you need to set plugin.config. First, let's look at the plugin.config format.
This is the config I wrote.
Here are 3 main places:
- The first line of the directory, must be consistent with your directory name, that is, the last level of the Web/plugins/databasemanager directory consistency, the next few configuration items have little impact. Isload first to write 0, otherwise it will not be installed;
- Install SQL that part, you can put the SQL to create table, unload the SQL section can be put in the SQL drop table, I do not do a demonstration here;
- The last Nav there is the configuration backstage, name casually write, title is the background display name, the URL is written admin/index.aspx, and then the background configuration of the list page is admin/index.aspx, action has a few values, specific as
This creates a complete plug-in, then you can see the effect in the background, we can install the new plugin
DTCMS plug-in production example electronic resource management (i.)