Jump to main content Jump to doc navigation

modX::lexicon

Grabs a processed Lexicon Entry.

This may also be a modLexicon object as well, if the Lexicon has been loaded. PHP supports having objects and methods with the same name.

Syntax

API Doc: modX::lexicon()

string lexicon (string $key, [array $params = array()], [$language = ''])
  • $key (string) lexicon key. required
  • $params (array) array of additional parameters for passing values into the record, see second example below
  • $language (string) language key, cultureKey value will be used by default.

Example

Output the translation of the 'welcome_message' Entry, and sets the 'name' Placeholder in it.

echo $modx->lexicon('welcome_message', array('name' => 'John'), 'en');

The above example assumes a message that contains a placeholder for "name", e.g.

$_lang['welcome_message'] = 'Hello [[+name]]!  How are you today?';

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • CrewMark
  • Chris Fickling
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$301 per month—let's make that $500!

Learn more