strip_tags() function strips HTML, XML and PHP tags.
strip_tags() function strips HTML, XML and PHP tags.
The code is as follows:
<?php echo strip_tags(“Hello <b>world!</b>”); ?>
You can use strip_tags in smarty to remove html tags, including any content between < >.
For example:
index.php:
The code is as follows:
$smarty = new Smarty; $smarty->assign(‘articleTitle', “Blind Woman Gets <span style=”font-family: &amp;”>New Kidney</span> from Dad she Hasn't Seen in <strong>years</strong>.”); $smarty->display(‘index.tpl');
index.tpl:
The code is as follows:
{$articleTitle} {$articleTitle|strip_tags}
Output result:
The code is as follows:
Blind Woman Gets <span style=”font-family: helvetica;”>New Kidney</span> from Dad she Hasn't Seen in <strong>years</strong>. Blind Woman Gets New Kidney from Dad she Hasn't Seen in years.
Article interception:
The code is as follows:
{$article.content|truncate:35:”…”:true}