Connecting plug-in in Administration Panel

<< Click to Display Table of Contents >>

Navigation:  For developers >

Connecting plug-in in Administration Panel

DataLife Engine provides convenient mechanisms for connection of developed script modifications. These mechanisms provide operation of plug-ins after updating to a new version of the script, because these mechanisms allow you to connect plug-ins without editing script files.

 

In order to connect your plug-in in Administration Panel you need to place your file in engine/inc/ folder. Only files in this folder can be connected. For example, the name of your file is mymod.php and you have placed it in engine/inc/ After that you can call and access your plug-in from Administration Panel at: http://site.ru/admin.php?mod=mymod where mymod is your plug-ins name without .php extension. The connection is performed automatically, no change in the script files is required.

 

 

In order to prevent users from entering the address of your plug-in in the browser manually and it could be accessed in the list of all section in Administration Panel, a special table is created in the MySQL. This table's name is: PREFIX_admin_sections. PREFIX can be read by your installation script from engine/data/dbconfig.php. This table contains the following fields:

 

name - The name of your plug-in. Namely, it is a .php file from engine/inc/ folder, but without the file extension. For example, if the name of your file is mymod.php, then mymod must be entered in this field.

 

title - Your plug-in's title.

 

descr - Your plug-in's description.

 

icon - Contains the name of the icon for your module without its path. The icon must be located in engine/skins/images/ (it is required). Recommended icon size is 70x70 pixels.

 

allow_groups - Contains information about the groups where this plug-in is allowed. This field can take the following values: all or ID of groups separated by commas. For example: 1,2,3. If all value is specified, then plug-in will be displayed for all users who have an access to Administration Panel.

 

 

Example of a request to record information about mymod plug-in:

 

INSERT INTO `prefix_admin_sections` (`name`, `title`, `descr`, `icon`, `allow_groups`) VALUES

('mymod', 'Name of the test plug-in', 'Description of the test plug-in', 'mymod.png', '1');

 

After executing the query this plug-in will be listed in the Administration Panel for Administrators only.

 

ATTENTION: If you specify groups in the database, it will not prohibit or prevent users from other groups from launching the plug-in. Your plug-ins are required to produce the check of user groups by themselves and they should be launched by allowed user groups only.