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 use html_entity_decode in Phalcon volt?

In Phalcon how could use the html_entity_decode function?

I used the below syntax to decode the content


but not working [[ ]] are used for angular js interpolation

edited Dec '17


Volt does not expose the global PHP context, so you have to explicitly register the function.

// services.php
$volt = new Volt($view, $di);
$compiler = $volt->getCompiler();
$compiler->addFunction("html_entity_decode", "html_entity_decode");

When I used this code '{{ html_entity_decode('[[ eventSessionDetails.session_details ]]')}}' in Volt showing the content with html tags not decoding. If I hard coded the html code then it's working fine like {{ html_entity_decode('<h1> Welcome </h1>')}} then it's showing with decoded welcome. Could you please suggest me on this?

Used ngSanitize in angular to solve my issue. Now its working fine. Thank you