Page 1 of 1

Strip html with smarty

Posted: Fri Sep 29, 2006 8:15 am
by rammy
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

Posted: Fri Sep 29, 2006 8:56 am
by a94060
may not be what you are looking for but you could use

Code: Select all

strip_tags()
to do what you want

Posted: Fri Sep 29, 2006 7:06 pm
by rammy
Thanks a94060. Its a good resource. PHP does have some tags that can solve my query. But I dont think my 'free' blog supports PHP. But it does support {smarty} for sure.

Posted: Fri Sep 29, 2006 7:37 pm
by Luke
well I don't think it's possible with just smarty, but have you tried http://smarty.php.net/ ?

Posted: Sat Sep 30, 2006 4:50 am
by rammy
Yep I have been digging it for quite a while now. No success though :? But theres something that can be done for sure.

Thanks

Posted: Sun Oct 01, 2006 3:19 am
by jmut
rammy wrote:Yep I have been digging it for quite a while now. No success though :? But theres something that can be done for sure.

Thanks
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.

Posted: Sun Oct 01, 2006 12:52 pm
by rammy
Ok jmut I will try to do that.

Posted: Sun Oct 01, 2006 2:34 pm
by Oren
Here is what you are looking for:

Code: Select all

{$smarty.capture.cats|@strip_tags}

Posted: Tue Oct 03, 2006 4:59 am
by rammy
Awesome and thanks a lot Oren. This is exactly what I was looking for :D