Direct access to the module files

To work off-site file structure described modules/module_name/module_name.function.php. This file can be called directly as: http://site.com/модуль/function/.

Direct access to the module may be needed for the following reasons:

  1. Page module should exist regardless of whether the corresponding page in the site structure is created. Thus the need to protect against accidental deletion functionality page.
  2. Page module has a business nature and should not be displayed on the site map, in the file sitemap.xml, menu and so on.
  3. When working with a part of the module you need to get rid of extra requests for page definition.

The file modules/module_name/module_name.function.php available basic system class $this->diafan. Through this variable, you can access to the users, cache, router, and connect the templates, as well as connections to the modules.

In addition, before connecting the files is the start of the session, determined the requested language version of the site, a temporary site and the user area. All these data can be used in the file of module.

If the requested address http://site.com​/module_name/function/some_data/, the data is inherent in the link, the module will be available in the form: $_GET["rewrite"] = 'some_data';

Examples of the implementation of a direct appeal to the module in DIAFAN.CMS:

modules/captcha/captcha.get.php – http://site.com/captcha/get/ – генерирует изображение защитного кода;
the modules / news / news.rss.php - http://site.com/news/rss/ - generates RSS-feed news;
modules/payment/payment.get.php – http://site.com/payment/get/ – работа с платежными системами;
modules/useradmin/useradmin.edit.php – http://site.com/useradmin/edit/ – форма редактирования данных из пользовательской части;
the modules / the attachments / attachments.get.php - http://site.com/attachments/get/ - gives attachment.
  • modules/captcha/captcha.get.phphttp://site.com/captcha/get/ – generates image of captcha;
  • modules/news/news.rss.phphttp://site.com/news/rss/ – generates RSS-feed of news;
  • modules/payment/payment.get.phphttp://site.com/payment/get/ – works with payment systems;
  • modules/useradmin/useradmin.edit.phphttp://site.com/useradmin/edit/ – form of editing from quick edit panel;
  • modules/attachments/attachments.get.phphttp://site.com/attachments/get/ – get attached file.