Yes, with commands like implode() you need to write a wrapper-
function, if you want to use it as a modifier. In Outline you have a
few options - one is to write a simple wrapper function:
function outline__implode($array, $glue = ', ') {
return implode($glue, $array);
}
You don't have to register that or do anything else, just make sure
the function is loaded when you render your template, and it'll work
like this:
{$myarray|implode:' - '}
would produce: "a - b - c" etc.
You can also call php functions directly, if you prefer, e.g.:
{#implode(' - ', $myarray}
The # command lets you execute any php function, using php syntax, and
echo it's return value. You don't need the outline__implode() function
if you choose this method.
If you prefer your templates to be closer to straight php, you can
actually just use this command all way round - any php function can be
called using {#xxx} syntax, doesn't have to be function calls either,
you can use any standard php expression, e.g.:
{#$a.strtoupper($b).'/'.md5($c)}
The ternary operator is sometimes handy as well, e.g.:
{$numfiles} {#$numfiles == 1 ? 'file' : 'files'}
Think creatively :-) ... what's great about Outline, in my own
opinion, as compared to other template engines, is the ability to use
any php expression/function anywhere you please. There's a lot you can
do with standard php out of the box, that's why Outline itself
implements so few commands and modifiers - pretty much everything you
need is already in php, it's just much easier to get to it this
way ;-)
On May 20, 6:36 pm, "
mbiso...@googlemail.com"