Modular scripts

Modular scripts are the basic building blocks that serve to create an online store showcase, plus, with their help, you can also form the store logic, and also use them as web modules to expand the basic functionality of the Melbis Shop windows application. But first things first.

First of all, let's look at the names of module scripts. Melbis Shop has a rule that a script must be named in a certain way. The first word in the script name is the company name or its abbreviation, the second word is the name of the group into which the modules are grouped, and finally, the third and subsequent words are any words at your discretion that explain what the script does. The underscore sign is used as a separator between words. Here are some examples of module script names:

melbis_base_topic.php, melbis_cataloge.php, melbis_inc_logic.php

There are two types of modular scripts: a regular module and a library module . If a script has a group name inc (you can also use include), then it is a modular script of the "library" type.

What are their differences? Regular module scripts are numerous, and they are what the parser will call to form the necessary fragment of HTML code for the corresponding page. Library module scripts (inc, include) are designed to eliminate duplication of the same program code in regular modules. That is, they can be attached to different modules and contain some universal functions. Another feature is that library modules do not have their own HTML templates.

While working on the script, in the right part of the screen of the "Development Environment" section, you will see a window with a list of library modules. In order to include one of the libraries in a regular module, you need to check its box. After that, you will be able to call the functions that are defined in this library. It is also important to note that libraries, in turn, can attach other libraries to themselves, i.e. recursive (nested) calling of modules is allowed.

It should also be mentioned that there are special library modules, for example melbis_inc_logic.php . This module contains the logic of calculating and forming an order. It includes many ready-made functions that you can use to form an order when building a showcase. But the most interesting thing is that this same module and its functions will also be used in the Melbis Shop application when creating an order. That is, you get a single logic for different ways of placing an order!