Henk Z Henk Z - 4 months ago 15
Smarty Question

Edit php line Smarty template engine

I want to edit my php template, but I can not get it right.
I use the the Smarty template engine.

My default php line looks like this:

{$childItem->getLabel()}


That does display HTML like this:

MY TEXT <br><span class="text-domain">TEXT</span>


I want to remove all content after the
<br>
. So that it only displays the
MY TEXT
part.

I tried this, but that does not work:

{$childItem->getLabel()|replace:'<br>' : ''}


How can I fix this?

Answer

use stristr function

{$childItem->getLabel()|stristr:'<br>' : true}
Comments