Working with Addons/Modules/Views

Usage of modules

Module class

Each module object that we develop inherits from the module object provided by the framework. This parent class is found at framework/kernel/module.class.php

Let's examine each of this object methods and see how we can use them.

string config(string $item [, string $section])

Returns the same value that would be returned by the parent addon config() method.
Each module has access to the parent addon config file as if the file was defined for the module.

See addon's config() method.

string id_addon()

Returns the name of the module's parent addon.

string language(string $item [, string value1 ][, string $valueN])

Returns the language translation value for key $item.
Each module has access to the same language translation files as its parent addon.

See addon's language() method.

See also: language management.

object load_module(string $id_modeule)

Loads the addon's module and returns a reference to this instance.
This method works identically to the parent addon's method.

See addon's load_module()

object load_view(string $file [, array $params = array()])

Loads the view file and returns a view object instance initialized with the view file.
This method works in a similar way to the parent addon's method.
The only difference with the parent addon is where the views are loaded from.
As explained in addon's load_view() above, the view file is searched in the addon's views directory, first at the appplication level and then at the framework level.

The views loaded from a module are assumed to be located in a subdirectory of the modules directory and bearing the name of the module.
For example, if the module 'backend' of addon 'articles' tries to load view 'show_controls' then the view file should be located at:




For a complete discussion of the load_view() method see addon's load_view().