Module Development and includes

24-07-2014, 16:28. Author: dlestarter
Home » DLE Extra » Module Development and includes
DataLife Engine provides a convenient mechanism (or sub-system) for the developers to script developments and modifications. These mechanisms (or sub-system) allow for performance after the script upgrade on the new version, because These mechanisms (or sub-system) allow you to include without editing the script files. Designed to connect your modules you need in any desired themes to add your tag:

{include file="engine/modules/mymod.php"}

where engine/modules/ this is the path to your module, and mymod.php is the name of the include file. The standard DataLife Engine module files are in this folder, and we recommend that you use this folder, but this is not a requirement and the file can be located in any other folders on the server. The only limitation on file include is modules security, because the file should be set the permission writable permission which should be writable (CHMOD 777). We also recommend that you use relative paths to include the modules, DataLfe Engine automatically detects and connects the relative path of your modules which are already in accordance with your script and paths where you installed the script. Thus, you can create a generic installation instructions for your modifications.

You can also include your PHP module files in your PHP by passing various parameters, such as:

{include file="engine/modules/mymod.php?param=value1&variable2=value2"}

Using such a connection and includes, you can make your changes multifunctional, which will perform various roles and functions for different connections.

The plug-ins parameters was first introduced with DataLife Engine version 8.3, you can specify a script template tag with included file tag, For example, when added to the full news in the template design {include file="engine/modules/mymod.php?param={news-id}"}, you can tell your side of the module as a parameter news ID, etc. Attention developers: Passed to the script parameters, using GET parameters, respectively, when choosing a sent tag you should consider not to use GET string, because you can not pass as a parameter to the full news content to to match exactly.

You can also use include of modules and to replace the main block that displays news and other basic information, it is necessary to use this tag with the tag [aviable=page]Text[/aviable] and [not-aviable=page]Text[/not-aviable] Description tags, see the documentation in the section "Basic Main tag and page displays". You can use a standard list of sections, and use your own section URL. You can make it simple ans easy to use and access, for example, you want to add to the standard sections of the site, add your section and display the information in it from your module. Let's say you want to create a section FAQ. To do this in the template design main.tpl prescribed:

[aviable=faq]{include file="engine/modules/mymod.php"}[/aviable]

[not-aviable=faq]{content}[/not-aviable]

With that example you will be able to access to your website using: http://site.com/index.php?do=faq, News or content for your module will be displayed instead the site content.

To use your own modules and output it in your template where the tag is inserted above, be sure to only one important condition. Listing information must be carried out only through the PHP function echo. For the example of a simple module and output. Create a file mymod.php with the following contents:

<?php

echo "The test module";

?>

When include this file in the template, this template will place text: The test module

The list of variables and DLE classes that you can use in your plug-in without any problems:

Attention: Your module should only read the data from these variables, changes the values ​​of variables will result in failures in the standard features of the script and can cause script stop working or malfunctioned.


Go back