On 08-06-2009 at 18:41:10 Igor Sverkos
phptal_tales_myDate() is called at compile time only. It should not
return the date (because there isn't any value yet), but code that will
generate the date at run time.
phptal_tales() returns code that will evaluate to the value.
return 'date("o-m-d H:i:s", ' . phptal_tales($src, $nothrow) . ')';
Could you explain to me, why I should write and use a custom
function, when I could do the same by just calling PHP directly (php:
Sure, you can use php: expressions if that suits you.
Expression modifiers are syntactic sugar and allow you to use
shorter/nicer expressions in templates. They can have their own
special-purpose syntax (you can preprocess/split the expression before
passing it on to phptal_tales()).
I don't understand/see an advantage, when I just call a phptal_tales()
function, which seems to be just a wrapper...
phptal_tales() is TALES to PHP compiler.
This is another benefit, because with php: modifier you need to use a bit
awkward type-dependent syntax (e.g. foo[bar].baz), but with if you use
phptal_tales(), your expression modifier may accept simpler "foo/bar/baz"
PHPTAL mailing list