Strip html with smarty
Moderator: General Moderators
Strip html with smarty
Hi,
I am a newbie in smarty. I have been trying to learn a few things up from the resources available in the net. But this is really bothering me for the last few days now as I cant do this.
What I have is this:
{capture name=cats}{list_cats}{/capture}
and what I get ($smarty.capture.cats) from this is ...
<li><a href="http://www.example.com/cat1.html" title="Category one">One</a></li>
<li><a href="http://www.example.com/cat2.html" title="Category two">Two</a></li>
Now what am trying to do is scoop the One and Two i.e. strip all the other stuff. How shall I do that only with smarty or thruogh Java Script? Please help ..
TIA
I am a newbie in smarty. I have been trying to learn a few things up from the resources available in the net. But this is really bothering me for the last few days now as I cant do this.
What I have is this:
{capture name=cats}{list_cats}{/capture}
and what I get ($smarty.capture.cats) from this is ...
<li><a href="http://www.example.com/cat1.html" title="Category one">One</a></li>
<li><a href="http://www.example.com/cat2.html" title="Category two">Two</a></li>
Now what am trying to do is scoop the One and Two i.e. strip all the other stuff. How shall I do that only with smarty or thruogh Java Script? Please help ..
TIA
may not be what you are looking for but you could use to do what you want
Code: Select all
strip_tags()well I don't think it's possible with just smarty, but have you tried http://smarty.php.net/ ?
you can add a modifier or function in php to use in Smarty and that will do what you need. Smarty itself does not support such stripping....and quite normal. This just does not sound like View problem.rammy wrote:Yep I have been digging it for quite a while now. No success thoughBut theres something that can be done for sure.
Thanks
Here is what you are looking for:
Code: Select all
{$smarty.capture.cats|@strip_tags}