php - Replace all html special characters in Smarty
I want to truncate a string in Smarty
This is the scenario:
The string is "Test!abc".
Maximum characters allowed = 5.
Smarty gets string.
If I use{$string}
, I get the desired result "Test!abc"
If I use{$string|truncate:5:"..":true}
I get "Test&.."
How can I make truncate after html chars conversion. Prefer not to make it in php.
I know about "replace", but it will look like "|replace..|replace..|......"
Answer
Solution:
You could try something like:
Answer
Solution:
If you're using Smarty 3.1 you can have a look at the unescape modifier.
Answer
Solution:
In Smarty 2 you can try this one