Friday 10 December 2010 1:24:31 am
Now we will study the example “jacextension” to learn the basics of extension development in eZ Publish. We will walk through the steps of creating an extension and will look at the basic PHP classes in the eZ Publish Framework.
The tutorial will cover the following concepts:
To work through the tutorial, eZ Publish first must be properly installed (download the latest version here). To do this, create a default site using the eZ Publish Setup Wizard, specifying “URL” in the siteaccess configuration and a MySQL database called “ezp_plain” (character set utf-8).
This creates two siteaccesses: plain_site and plain_site_admin, accessed through the following URLs:
http://localhost/ez/index.php/plain_site (User view)
http://localhost/ez/index.php/plain_site_admin (Administrator view)
(localhost/ez/ is the root path of the eZ Publish directory.)
Now we will create and activate a new extension called “jacextension”. It will contain one module called “modul1”, with a view list that runs the PHP script list.php.
To do this, on the system command line we navigate to the directory extension/ beneath the main eZ Publish directory and create a new directory called jacextension/ with the following subdirectories and PHP files:
ez/ |-- extension/ | |-- jacextension/ | | |-- modules/ | | | |-- modul1/ | | | | |-- list.php | | | | |-- module.php | | |-- settings/ | | | |-- module.ini.append.php
In the configuration file module.ini.append.php we tell eZ Publish to search for modules in jacextension. This will make eZ Publish try to load all modules (such as modul1), which are in the directory extension/jacextension/modules/ .
Hint: In INI entries be careful not to leave blank spaces at the end of lines, as the variables might not be parsed correctly.
<?php/* #?ini charset="utf-8"? # tell ez publish to search after modules in the extension jacextension [ModuleSettings] ExtensionRepositories[]=jacextension # For eZ Publish 4.1 and up you'll need to specify your module name as well ModuleList[]=modul1 */ ?>
Listing 1. Module configuration file: extension/jacextension/settings/module.ini.append.php