Skip to the content
Documentation

ezini

No ratings yet

Summary

Provides read access to settings in the configuration files.

Usage

ezini( section, variable [, ini_file [, ini_path [, dynamic [, check_existence ] ] ] ] )

Parameters

Name Type Description Required
section string Section to read value from. Yes.
variable string The name of the directive that should be accessed. Yes.
ini file string The target configuration file (default is "site.ini"). No.
ini_path string Custom path to the configuration file(s). No.
dynamic boolean If the specified directive should be dynamically checked. No.
check_existence mixed If the specified directive should be checked for existence. No.

Returns

A string containing the value of a configuration setting.

Description

This operator makes it possible to access the settings in the configuration ("*.ini") files. The "ini_path" operator can be used to set a custom path where the configuration files are located (default is the settings directory). The "dynamic" parameter can be used to force the system to actually check the ini file, otherwise the value will be checked upon template compilation and "hardcoded" in the compiled template. The "check_existence" parameter can be set to TRUE or the string "hasVariable" in order to check if a directive is actually set. In this case, the operator will return either TRUE or FALSE. Note that using the "ezini_hasvariable" operator is a better option.

Examples

Example 1

{if eq(ezini( 'SomeSettings', 'Test', 'example.ini' ), 'hello' )}
    [...display something...]
{else}
    [...display something else...]
{/if}

Conditional branching based on an configuration setting.

Contributors

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. Return value

    lorbas ·

    the return value also can be a array of strings

Comments

Add a comment

Comments are read by a moderator before they appear.