We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to get the type file in volt ?

How to get the type file in volt ? I usually retrieve in php by strtolower(substr(strrchr($filename, '.'), 1)); So in the volt how to do? Thank

You can do the same, you just need to add functions. https://docs.phalcon.io/en/3.1/volt#extending-functions

edited Jun '17

If your problem does not involce security and it is just for presentation you can add the functions to volt, like Wojciech suggested:

 $compiler->addFunction('strtolower', 'strtolower');
 $compiler->addFunction('substr', 'substr');
$compiler->addFunction('strrchr', 'strrchr');

However if you want to do things right and do not trust the filename itself, you should go with finfo.