Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.