Domanda

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!

È stato utile?

Soluzione

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);
});
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top