Jump to content

Containing html tags inside a div


Porl123

Recommended Posts

I have a forum where each user comment is contained inside its own div and I've noticed that if a user leaves a bb code (bold for example) open then it affects everything from that point on in the page. Is there a way to stop the html tag from leaking out into the page?

 

If anyone knows a method or needs anymore information please just ask me. (: Thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/238050-containing-html-tags-inside-a-div/
Share on other sites

I know this isn't the right section for this, but it's just a quick question. D:

 

$content = preg_replace('/\[b\](.*?)(\[\/b\]|$)/i','<strong>\\1</strong>',$content);

 

That's what I've replaced the individual open and close tags with. I want it to either match when it sees there's a [/b] or it reaches the end of the content. Although for some reason this doesn't seem to be matching when it reaches the end of the content, only when it identifies there's a [/b]. Do you know what I'm doing wrong?

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.