modX.setPlaceholders

Skip to end of metadata
Go to start of metadata


modX::setPlaceholders

Sets a collection of placeholders stored in an array or as object vars.
An optional namespace parameter can be prepended to each placeholder key in the collection, to isolate the collection of placeholders.

Note that unlike modX.toPlaceholders, this function does not add separators between the namespace and the placeholder key. Use toPlaceholders() when working with multi-dimensional arrays or objects with variables other than scalars so each level gets delimited by a separator.

Syntax

API Doc: http://api.modxcms.com/modx/modX.html#setPlaceholders

void setPlaceholders (array|object  $placeholders, [string $namespace = ''])

Example

Add an array of placeholders, and prefix 'my.' to their key.

$modx->setPlaceholders(array(
   'name' => 'John',
   'email' => 'jdoe@gmail.com',
),'my.');

See Also

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.