Garrett Posted October 16, 2009 Share Posted October 16, 2009 I have a mysql database that allows users to enter content with html, but I also want to have a tag that will disable the html between it for example: <a href="a.html">a</a> [nohtml] <a href="b.html">b</a> [/nohtml] Thus it should look like after formatting: a <a href="b.html">b</a> How would I go about doing this? Quote Link to comment Share on other sites More sharing options...
trq Posted October 16, 2009 Share Posted October 16, 2009 You need to use & [pre][/pre] tags when posting examples on this board. We now have no idea what your examples are meant to look like because of the way the form parses special tags. Quote Link to comment Share on other sites More sharing options...
Garrett Posted October 16, 2009 Author Share Posted October 16, 2009 Before format: <a href="a.html">a</a> [nohtml] <a href="b.html">b</a> [/nohtml] After format: (a being a link) a <a href="b.html">b</a> Quote Link to comment Share on other sites More sharing options...
isedeasy Posted October 16, 2009 Share Posted October 16, 2009 http://php.net/manual/en/function.htmlspecialchars.php Quote Link to comment Share on other sites More sharing options...
mikesta707 Posted October 16, 2009 Share Posted October 16, 2009 I would do an htmlentities on the text between no html tags Quote Link to comment Share on other sites More sharing options...
Psycho Posted October 16, 2009 Share Posted October 16, 2009 You could do as suggested above by using preg_replace() or something similar to capture all the text between those custom tags and escape it with one of the PHP functinos for doing so. But, there may be an even easier solution. You could just replace all the [ nohtml ] and [ /nohtml ] tags with < pre > and < /pre >. I think that would give you similar results. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.