Force close ALL BBCode?
#1
Yo,

So I know have all my HTML stripped and things but now I need to force close all tags for instance if the user doesn't close it won't make the whole page below bold is there anyway to do this?
Got it now
$txt = str_replace("[b]", "<b>", $txt."</b>");
$txt = str_replace("
", "</b>", $txt);
should work right?
Reply
#2
If someone doesn't close the tag, the BBCode won't parse. It doesn't work like HTML in that respect.

Example:

[b]Ladeeda
-Paul H.

Cogisne lingua latina?
Reply
#3
It uses regex to something that starts with and ends with . it doesn't just str_replace("[b]","<b>",$post['message']); etc.
Toungue
Reply
#4
Hmm ok, well the way I worked out works fine at the moment Smile thanks for the replys.
Reply
#5
what you did wont do anything though? :\ lol.
Reply
#6
(2012-01-05, 10:38 PM)Booher Wrote: what you did wont do anything though? :\ lol.

Lol stut up
Reply
#7
I don't see what the problem is? If you don't close the tags you will just see:

[b]your text here
Reply
#8
I really failed descriving my issue, it's a project I have.
Reply
#9
You're seriously using str_replace and not regex? Have fun with your spaghetti parser.
Reply
#10
(2012-01-10, 10:32 PM)itheme Wrote: I really failed descriving my issue, it's a project I have.

That was possibly a small oversight Toungue you should maybe have mentioned that Toungue also, regex is your friend, use it Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)