Skip to content

Tokens within JSON

rogerlos edited this page Jun 16, 2017 · 1 revision

Flexwalker has a rudimentary tokenizer for use with JSON config files.

Tokens are indicated with double braces:

{{potentially.nested.arg.key}}

The internal content is always evaluated as a key to look for within the $args array. Nesting is accomplished with "dots". In the above case, Flexwalker will look to see if $args, the args array which was merged with $this->cfg, has this value:

$args['potentially']['nested']['arg']['key']

If it doesn't, it will return an empty string.

Tokens might be handy if you want to repeatedly call Flexwalker using data which changes but always has the same keys. It's also a handy way of allowing yourself to sometimes pass data, but have it default to an empty string if it isn't present.

Clone this wiki locally