Once we have created our extension, including the folders and the files necessary to make it work, we should activate it. Obviously, our extension is currently empty and so it does not add anything to the standard eZ Publish design. But in the next few chapters, we will complete that development with all the necessary code.
There are two ways to enable an extension. The first is to manually edit the configuration files of eZ Publish, and the second is to access the backend and enable it through a visual interface.
The first way is convenient if you want to activate the extension only for certain siteaccesses, and not in a global manner. But with the second way, you can activate the extension only for the whole installation. This means that we'll activate the extension for all of our siteaccesses.
To manually activate the extension for all siteaccesses, we need to change the global file site.ini.append.php
, by executing the following commands from the shell:
# cd /var/www/packtmediaproject/settings/override/
# vi site.ini.append.php
Next, add the following code:
<?php /* #?ini charset="utf-8"? ... [ExtensionSettings] ActiveExtensions[] ... ActiveExtensions[]=packtmedia ... */ ?>
Here, the ActiveExtensions
parameter tells the system to enable our new extension, globally.
Or, if you want to activate the extension only for some siteaccesses, we have to modify the site.ini.append.php
file inside every siteaccess that we want to activate it for.
To do this, we need to execute the following lines from the appropriate extension folder:
# cd /var/www/packtmediaproject/settings/siteaccess/ezwebin_site
# vi site.ini.append.php
Next, we have to add the following code:
<?php /* #?ini charset="utf-8"?
...
[ExtensionSettings]
ActiveAccessExtensions[]=packtmedia
...
*/ ?>
In this case, the ActiveAccessExtensions
parameter will enable the extension only for the specified siteaccess.
Every time you add PHP classes that must be loaded automatically by the system autoload, you should run the script from the shell:
# cd /var/www/packtmediaproject
# php bin/php/ezpgenerateautoloads.php -e
This script will add our classes to the autoloads array.
Another way of enabling an extension globally is by doing so from the backend.
The following steps should be carried out to enable the extension through the graphical interface. Go to the backend of our website at http://packtmediaproject/index.php/ezwebin_site_admin
, and:
At this point, our extension is active, but our siteaccess will still not use our custom design. To enable the use of custom designs, we have to edit the site.ini.append.php
file of the siteaccess. We want to use the design by executing the following commands from the shell interface:
# cd /var/www/packtmediaproject/settings/siteaccess/ezwebin_site
# vi site.ini.append.php
And now we will change the [DesignSettings]
directive as follows:
<?php /* #?ini charset="utf-8"? ... [DesignSettings] SiteDesign=magazine AdditionalSiteDesignList[]=ezwebin AdditionalSiteDesignList[]=base AdditionalSiteDesignList[]=standard ... */ ?>
In this way, our siteaccess will first use the magazine
template designs and, if they are not present, will use the default one.
52.14.134.130