Module: BBCode, Escaping Brackets (code included)

Posted by optimal 
Module: BBCode, Escaping Brackets (code included)
April 21, 2008 04:39PM
I've made a minor mod to my bbcode.php file so that I can show tags as text in my posts (so I can explain to people how to write them without them being all screwed up), added in this line:

// [DRK] - escaped brakets should be display as brackets...
$body = preg_replace("/\\\]/is", "]", $body);

$data[$message_id]["body"] = $body;

Now I can escape the right bracket and have the thing display as plain text, not sure how the [ quote ] loop effects things, I guess we'll see! Example of what I could write to explain how to bold some text

[b\]bold text[/b\] displays as bold text

(obviously it wont look right on this forum... hehe)



Edited 2 time(s). Last edit at 04/21/2008 07:11PM by optimal.
Re: BBCode Escaped Brackets
April 21, 2008 05:20PM
I think maurice and brian added a solution for that to the new bbcode parser written at the conference.


Thomas Seifert
Re: BBCode Escaped Brackets
April 21, 2008 06:36PM
That's cool!

Excuse my daft ramblings, I'm new to phorum, so not really up to speed with the news, conferences and so forth! Loving it so far!
Re: BBCode Escaped Brackets
April 21, 2008 07:11PM
Yeah, still working on the new parser code, which is a real parser. In that parser, I'm building in the option to be able to escape bbcode tags by prefixing them with a backslash, like \[code]. This then shows up as [code] instead. I'm pretty far with the new code and looking at its progress, I think it might be in the next Phorum release already. If not, then we'll post a separate BBcode module package that you can try out.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 04/22/2008 11:22AM by mmakaay.
Re: Module: BBCode, Escaping Brackets (code included)
April 21, 2008 07:22PM
Awesome work Maurice!

I've written a few variations on the theme of BBCode parsing from the ground up in previous side projects, if you want I can send them to you?? I'm actually writing a fresh one (starting tomorrow) for a new ecommerce project with a javascript editor, should I keep you in the loop with my developments?
Re: Module: BBCode, Escaping Brackets (code included)
April 21, 2008 07:49PM
I don't want to sound harsh, but no thanks ;-) The parser side is fully working and is pretty fast too. All that I'm doing now, is integrating the parser with the bbcode module. You can send them as study material, but I'm not sure if I'd actually use something from your code. Thanks for the offer though.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 04/21/2008 07:49PM by mmakaay.
Re: Module: BBCode, Escaping Brackets (code included)
April 21, 2008 09:42PM
No worries fella, sounds like you have it all under control!

I'll whip you a PM when I'm done with my new code anyway, just in case like!


If it moves, eat it. If it doesn't move, wait till it moves, then eat it
Re: Module: BBCode, Escaping Brackets (code included)
April 22, 2008 02:04AM
Sure, please do so! If you want a peek at my latest BBcode parsing attempt, then download the brand new BBcode module that I just uploaded for testing.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: BBCode, Escaping Brackets (code included)
April 22, 2008 02:52PM
The coding looks awesome! I think I might give a similar module a go so that my forums have the same markup as my other sites. Should be interesting!

FYI: I'm using Phorum as a support site for my other project, I dont want to confuddle my users with 2 different LML's!

PS, you write like a brit... either you're an insomniac brit, or I am way off the mark! Hawhaw


If it moves, eat it. If it doesn't move, wait till it moves, then eat it



Edited 1 time(s). Last edit at 04/22/2008 02:54PM by optimal.
Re: Module: BBCode, Escaping Brackets (code included)
April 23, 2008 03:50PM
brit as in British person? You're only a little bit off. I'm a genuine Dutchman. The insomniac part is only a little bit off too. I can sleep, I just don't like it, so I tend to stay up late and code at weird hours. I think insomniac has to do with not being able to sleep. At the moment, I code at regular hours though though, since I'm in the U.S., enjoying two weeks of vacation after the MySQL conference.

I'm glad you like the code. A lot of work was put into shaving and profiling the api.php file. That's where the meat of the whole thing is.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login