Forum Moderators: coopster

Message Too Old, No Replies

HTML tag problems

         

subhendu

8:27 am on Jul 31, 2010 (gmt 0)

10+ Year Member



I am working on a forum script. Members will post the code to the topics so the html tags should display them, here I have tried by using htmlspecialchars function and also by using htmlentities(). These are working and displaying the html tags to the screen. Now I don’t want the links also to be changed. These function changes all the tags.
Is there a way to restrict these function and not to change the <a href = > Tag ?
Or any other better way of doing this. I am not so comfortable with regular expression.

thanks

Matthew1980

9:26 am on Jul 31, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Subhendu,

Is this information being pulled from a DB, in which case you will need to do s str_replace() for each tag - or possibly even a preg_replace(), which admittedly is the better option.

If you have some code written down to use, post that (so long as it isn't a huge code dump - no-one likes doing other peoples homework :) ) and from there we can advise you better, unless this is all theoretical at the moment ;)

Cheers,
MRb