eZ Community » Learn » eZ Publish » An Introduction to Developing eZ...

An Introduction to Developing eZ Publish Extensions

Friday 10 December 2010 10:24:31 am

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

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  
$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

36 542 Users on board!

Tutorial menu

Printable

Printer Friendly version of the full article on one page with plain styles

Author(s)

Proudly Developed with from