Modules and views
Every page of Exponential is produced by a view of a module. A module groups related functions (content, user, section, shop); a view is one page or action of it (content/view shows a node, content/edit edits an object, user/login signs in). The address of a page names both, so understanding modules and views is understanding Exponential's URLs.
The system address of a page
/<module>/<view>/<parameter>/<parameter>/(<name>)/<value> /content/view/full/2 module content, view view, ViewMode=full, NodeID=2 /content/view/full/2/(offset)/20 the same, with the unordered parameter offset=20 /content/edit/58/3/eng-US edit object 58, version 3, in eng-US /user/login the login form
The parameters after the view are ordered: their meaning comes from their position. Parameters in the form (name)/value are unordered (view parameters): they can come in any order and are passed to the template as $view_parameters. With URL translation, a readable address such as /about-us stands for its system address, and both work (see URL translation). Siteaccess matching by path adds the siteaccess name in front: /admin/content/view/full/2.
How a module is defined
A module is a directory with a module.php and a PHP script per view. The modules of the kernel are in kernel/<module>/ and kernel/private/modules/; extensions have theirs in extension/<extension>/modules/<module>/. module.php declares the views and the functions that policies can grant. An extract of kernel/content/module.php:
$Module = array( 'name' => 'eZContentObject',
'variable_params' => true );
$ViewList = array();
$ViewList['view'] = array(
'functions' => array( 'read' ),
'default_navigation_part' => 'ezcontentnavigationpart',
'script' => 'view.php',
'params' => array( 'ViewMode', 'NodeID' ),
'unordered_params' => array( 'language' => 'Language',
'offset' => 'Offset',
'year' => 'Year',
'month' => 'Month',
'day' => 'Day' )
);
$FunctionList = array();
$FunctionList['read'] = array( 'Class' => $ClassID,
'Section' => $SectionID,
'Owner' => $Assigned,
'Group' => $AssignedGroup,
'Node' => $Node,
'Subtree' => $Subtree );
| Key of a view | Meaning |
|---|---|
| script | The PHP file that runs the view. |
| params | The names of the ordered parameters. |
| unordered_params | The (name)/value parameters and the names the script gets them under. |
| functions | The policy functions a user needs for the view, for example content/read. |
| default_navigation_part | Which tab of the administration is active. |
| single_post_actions, post_action_parameters | Map form buttons to actions, for views that handle forms. |
The $FunctionList entries are what you see in the role editor as module functions, with their limitations (Class, Section, Subtree and so on). See Access control.
What a view returns
The view's script usually fetches data, sets template variables and renders a template; it returns the result in $Result['content'] together with the path for the breadcrumbs. The kernel then places it into the design's pagelayout.tpl. A view can also redirect, return a kernel error (such as "not found" or "access denied") or ask for another view to run.
Modules of extensions, and which modules a siteaccess allows
An extension makes its modules known in its settings/module.ini.append.php:
<?php /* #?ini charset="utf-8"? [ModuleSettings] ExtensionRepositories[]=myextension ModuleList[]=mymodule */ ?>
ModuleList[] also keeps URL aliases from taking the name of a module. A siteaccess can switch modules off with site.ini [SiteAccessRules] Rules[] (for example Rules[]=access;disable followed by Rules[]=module;content/search), and the views a user may open are decided by roles. Views that everyone may use without a policy, such as user/login, are listed in site.ini [RoleSettings] PolicyOmitList[]. Building a module step by step: Extending Exponential 6.0, section 5.
In this section
Contributors
- Balazs Halasy
- Geir Arne Waaler
- Hansen Commenter
- MTLZ Commenter
- Graham Brookins Updated Maintainer
Comments (2 historical)
Written by readers of the earlier documentation sites, kept as they were.
Links
Hansen ·
Put some links here to tutorials and/or code examples for making custom modules, please.
Re: Links
MTLZ ·
An excellent article for creating Extensions (module inside) :
http://share.ez.no/articles/ez-pu...-to-developing-exponential-extensions