Modules

From e107 Wiki
Jump to: navigation, search

e107 Wiki: English | Русский | Deutsch | Français | Magyar | Português | Български | Česky | Nederlands | Ελληνικά | Italiano | Norske | Polska | Slovenščina | Español | Svenska | Translate: Wiki | Page

logo_wiki.png

Current Release 1.0.4 | e107.org | Download | Changelog | Forum | Plugins | Themes | RSS Feed of Latest Changes | Atom Feed of Latest Changes


How to write a plugin
Main page > I : First Aid > II : Development > III : Administration > IV : How To's > V : Plugin Writing > VI : Theming & Shortcodes


Adding your own include code to every page via class2.php

A plugin module - also called addon in the core - is a piece of code that will be automatically loaded via class2.php so that it can be executed on each page load.

Plugin authors may wish to do this for a number of reasons.

  • Registering an 'event' Creating routines to be performed on core event triggers
  • Integrating a stats counter
  • Overriding a core function

As of e107 v0.7.6, this is accomplished by simply adding an e_module.php file to your plugin folder.

Your plugin will then be registered as a module. Any plugin that has registered itself as a module just needs to place an e_module.php in it's root directory. class2.php will auto-detect this file and execute the code within in at each page load.

The e_module.php files will be run through a require_once() just after the init_session() function. So all e107 variables and user information will be available in your e_module.php

NOTE: Your plugin has to be installed in order for it to register a module. 0.7.6 includes a plugin-scanner in admin->database->Scan plugin directories to register recent plugins' changes.