How do I do selective tag stripping with Smarty. What I mean is that I want o strip the HTML tags. But not all. I want to allow some. For example. <b>,<p>, <a> etc.. but not allow some.. for example <script>,<iframe> etc.. is this possible with smarty? or do I need to process this myself before passing the output to smarty.
I believe it would be somewhat possible with Smarty using some basic library commands (equivalent to PHP's str_replace or preg_replace) but honestly it would be the last thing I would trust security wise. I would work on a class that strips the information in a more secure way (plenty of tutorials on this). Also a simple Google search will result in several pre-written classes that handle this process. Optionally you can just use the PHP strip_tags() function which takes in the content and exceptions not to strip.
yeah.. i used "html purified" with some of my other projects.. just thought that maybe I can let smarty do it this time.
Well like I said, it's probably possible since Smarty supports RegEx, but in my opinion not worth what space it might save in your actual PHP coding. Unless there's any particular reason why Smarty needs to handle it, I honestly see no point considering all the negatives it creates (poor security, hard to debug, etc.). You might just want to make your own Smarty module (assuming there isn't already one already out there) if you honestly want to stick with it. You can even port HTML Purified in there.