I was building a Smarty template. All was fine before i checked the validation.
The Truncate of the Description is included but the end tag will not be added. Any tag addings will not help.
The truncate is called like
{$products_data.PRODUCTS_DESCRIPTION|truncate:300}
The Description has more than 300 characters and it starts and ends with p
tags. After the truncate has cut it then i have just the starting tag <p>
.
Is there a way to cut HTML tags out for truncate?
It is rather difficult to filter out html tags, truncate the text, and then place back the html tags. I would suggest that you drop all html tags with strip_tags and then truncate the resulting text. If you want, you can then embed what's left into <p> tags:
{$products_data.PRODUCTS_DESCRIPTION|strip_tags|truncate:300}