Strip html with smarty

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rammy
Forum Newbie
Posts: 5
Joined: Fri Sep 29, 2006 7:35 am

Strip html with smarty

Post 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
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

may not be what you are looking for but you could use

Code: Select all

strip_tags()
to do what you want
rammy
Forum Newbie
Posts: 5
Joined: Fri Sep 29, 2006 7:35 am

Post 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.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

well I don't think it's possible with just smarty, but have you tried http://smarty.php.net/ ?
rammy
Forum Newbie
Posts: 5
Joined: Fri Sep 29, 2006 7:35 am

Post 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
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post 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.
rammy
Forum Newbie
Posts: 5
Joined: Fri Sep 29, 2006 7:35 am

Post by rammy »

Ok jmut I will try to do that.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Here is what you are looking for:

Code: Select all

{$smarty.capture.cats|@strip_tags}
rammy
Forum Newbie
Posts: 5
Joined: Fri Sep 29, 2006 7:35 am

Post by rammy »

Awesome and thanks a lot Oren. This is exactly what I was looking for :D
Post Reply