Using html_entity_decode with Smarty

by on September 22, 2009

Q: I have HTML formatted text in database and when calling the data from PHP (using html_entity_decode) the information is displayed in the correct format. When using the same function in smarty the HTML tags show and I am wondering if there is an alternative?

Here is some sample code:

{$obj->mCode[k].field|html_entity_decode}


One Response to “Using html_entity_decode with Smarty”
  1.  

    Does the code work without calling html_entity_decode, ie are you getting data to show at all? If so then the problem might be that smarty is actually modifying the code on the way into the database. You will want to see exactly what the code looks like in the database to make sure it is not double encoded or something silly.

    You are, from what I can tell, calling html_entity_decode as you should be so the problem is most likely with the data itself.