Skip to the content
Documentation
Help Start
Reading in:
  • German: 9,059 of 9,059 pages
About the help in other languages
All help pages

The expinfo operator

expinfo from eZTemplateExpInfoOperator - the active extensions, all available extensions, one extension's metadata from extension.xml and ezinfo.php, and the kernel information, which keys each mode returns, and which…

Download as PDF

Address: https://doc.exponential.earth/exphelp/viewer/help/template-operators/expinfo-operator.md

On this page

The expinfo operator

expinfo answers "which extensions are installed, which are active, and what version is this?" from a template. It is registered by eZTemplateExpInfoOperator (lib/eztemplate/classes/eztemplateexpinfooperator.php) through lib/eztemplate/classes/eztemplateautoload.php, and reads everything through the class expInfo (lib/ezutils/classes/expinfo.php).

Contents

  1. expinfo
  2. One extension
  3. Lists of extensions
  4. The kernel
  5. Related pages

expinfo

expinfo

The mode is the first parameter, or the piped string when there is no parameter:

ModeReturns (expInfo method)
none, '' or 'active'a hash of the active extensions, name to info (activeExtensions())
'all'every available extension, each with active true or false (availableExtensions())
'kernel'the kernel information (kernelInfo())
an extension namethat extension's info with active, or false when it does not exist (extensionInfo())
ParameterTypeRequiredDefault
mode or extension namestringnoactive extensions

There are no named parameters. Generated reference: expinfo.

One extension

The info of an extension is built from its extension.xml and its ezinfo.php (the <extension>Info::info() array), plus mtime, mtime_formatted, extension_name and active. Keys that an ezinfo.php adds, such as the third-party software notes of ezjscore, appear under their own names:

{def $ext = expinfo( 'ezjscore' )}
{if $ext}keys: {foreach $ext as $key => $value}{$key}{delimiter}, {/delimiter}{/foreach}

ezjscore {$ext.version}, license: {$ext.license|wash}, active: {$ext.active|choose( 'no', 'yes' )}{/if}

expinfo( 'no_such_extension' ) = [{expinfo( 'no_such_extension' )|choose( 'false', 'true' )}]

Output:

keys: name, version, copyright, license, info_url, Includes the following third-party software, Includes the following third-party software (2), Includes the following third-party software (3), mtime, mtime_formatted, extension_name, description, summary, author, meta, active
ezjscore 1.8.5, license: GNU General Public License v2.0 (or any later version), active: yes
expinfo( 'no_such_extension' ) = [false]

{if expinfo( 'name' )} is a safe way to make a template part depend on an extension being installed; test .active too when the extension must also be switched on.

Lists of extensions

{def $active = expinfo()
     $all = expinfo( 'all' )
     $piped = 'ezjscore'|expinfo
     $inactive = 0}
{foreach $all as $name => $info}{if $info.active|not}{set $inactive = $inactive|inc}{/if}{/foreach}
expinfo() returns {$active|count} active extensions; expinfo( 'all' ) returns {$all|count}, of which {$inactive} are not active.
'ezjscore'|expinfo works too: {$piped.name|wash}

Output:

expinfo() returns 62 active extensions; expinfo( 'all' ) returns 87, of which 25 are not active.
'ezjscore'|expinfo works too: eZ JSCore LS

Attribute access on the result works on a variable ($piped.name), but not directly after an operator applied to a literal: {'ezjscore'|expinfo.name} is a parser error ("Extra characters found in expression"). Assign the result first, as above.

The kernel

expinfo( 'kernel' ) returns a large hash, built once per request (buildKernelInfo()):

{def $k = expinfo( 'kernel' )}
sections: {foreach $k as $section => $value}{$section}{delimiter}, {/delimiter}{/foreach}

version keys: {foreach $k.version as $key => $value}{$key}{delimiter}, {/delimiter}{/foreach}

PHP sapi in this run: {$k.php.sapi}

Output:

sections: version, php, memory, server, database, ini, user, extensions, cache, filesystem, timestamps, git, composer
version keys: major, minor, release, state, development, alias, edition, full, full_alias
PHP sapi in this run: cli

The version section is meant for templates: $k.version.full is the release, as a string. The other sections describe the server: server includes the host name, document root and installation paths, php includes uname and the loaded extensions, database includes the database name, server and user (the password is replaced by ***), and git and composer the state of the checkout. Never print those sections on a page that visitors can see; they are for administration pages behind a login. The examples on this page print only section and key names, and the PHP SAPI of the command-line run.

All examples gave the same output interpreted and compiled on a development installation.

Become an Exponential Partner

Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.

Something wrong on this page? Report an error

Documentation license

This documentation is free documentation, licensed under the GNU Free Documentation License 1.3 or later.

Exponential Copyright © 1998-2026 Exponential Foundation and 7x