Blocks:with

Moves the scope down into an array of values, allowing one to type {$var} instead of {$array.var} within the {with} block

with(array $var)


 * var : the array where to move the scope

Example: Data: 'arr' => array( 'foo' => 'bar' ) Output: bar bar /

Note : The tricky thing with this plugin is that as the scopes moves to another location, you can not access the global variables anymore.

As you can see with the above example, {$arr.foo} within the {with} block is not valid and returns null. To fix this you can use the _parent and _root keywords. $_root links to the top-level scope, and $_parent goes up by one level. The magic $dwoo variable is not affected by this and is accessible in the same way no matter the current scope.

Example: Data: 'arr' => array( 'sub' => array( 'foo' => 'bar' ) ) 'url' => 'example.org' Output: bar / bar / bar example.org / example.org 0.3.3