INI file

Lastly we want to create our own default .ini file extension/jacextension/settings/jacextension.ini. This will store all the values we have set in templates or modules and those that may vary in different eZ Publish installations (for example, for showing special debug messages).

The default .ini can be overwritten by the "jacextension.ini.append.php" files, such as the override file for a siteaccess. Listing 22 is an example of an .ini file and Listing 23 shows how to access it via PHP, as we have extended list.php.

[JACExtensionSettings]
# Should Debug enabled / disabled
JacDebug=enabled

Listing 22. Configuration file of extension jacextension – extension/jacextension/settings/jacextension.ini

<?php
// ...
 
// read variable JacDebug of INI block [JACExtensionSettings]
// of INI file jacextension.ini&nbsp;
$jacextensionINI = eZINI::instance( 'jacextension.ini' );
 
$jacDebug = $jacextensionINI->variable( 'JACExtensionSettings','JacDebug' );
 
// If Debug is activated do something
if( $jacDebug === 'enabled' )
    echo 'jacextension.ini: [JACExtensionSetting] JacDebug=enabled';
 
// ...
?>

Listing 23. PHP access to INI files jacextension.ini – extension/jacextension/modules/modul1/list.php

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2013 eZ Systems AS (except where otherwise noted). All rights reserved.