Jump to content

[SOLVED] Disable html within defined tags


Garrett

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/177851-solved-disable-html-within-defined-tags/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.