temuri
temuri

Reputation: 2807

Volt templates - how to ignore PHP tags?

I'd like to distribute .volt template files to my system's registered users, however I want it to strip away all <?php tags.

Can it be done using some sort of callback?

Thanks!

Upvotes: 0

Views: 489

Answers (1)

Lukas Liesis
Lukas Liesis

Reputation: 26403

There are the table with all available filters http://docs.phalconphp.com/en/1.2.6/reference/volt.html#filters

but if you want something else, you should write your own filter, which you would use in volt:

http://docs.phalconphp.com/en/1.2.6/reference/volt.html#id3

something like this: (not tested)

$compiler->addFilter('escapePHP', function($resolvedArgs, $exprArgs) {
    return str_replace(array('<?', '<?php'), '', $resolvedArgs);
});

Upvotes: 3

Related Questions