corzblog bbcode parser preview



Here it is! My [search engine fodder] bbcode to html parser, and html to bbcode parser [/search engine fodder]!

This is the actual very onsite parser that parses the bbcode of my blogs and site comments, which as well its usual tasks of, well, you know, the parsing stuff, also moonlights doing a cute wee background demo of itself, you're looking at it. it knew you wanted to do that. hit the "preview" button to see at least one half of the parser's bbcode to html/html to bbcode functionality.

The front-end (below) is built-in to the parser, you just call the function and it creates the form. The cool, super-portable JavaScript bbcode buttons and functions come in the package, too. Have fun. Oh, and by the way, output is 100% pure HTML5, or nice plain bbcode, which ever way you look at it, it's free.

button to undo the last javascript change
cbparser quick bbcode guide..
Most common bbtags are supported, and with cbparser's InfiniTags™ you can pretty much just make up tags as you go along. If cbparser can construct valid html tags out of them, it will. Experimentation is the key, and preview often.

A few bbcode examples..
[b]bold[/b], [i]italic[/i], [big]big[/big], [sm]small[/sm], [img]http://foo.com/image.png[/img], [code]code[/code],[code]teletype[/code], [url="http://foo.com" title="foo!"]foo U![/url], and more.. To post code with indentation and/or strange characters, .htaccess, etc., use [pre][/pre] tags.
download cbparser
an HTML5 compliant bbcode parser



Welcome to the comments facility!


previous comments (twenty pages)   show all comments

numstruck - 03.12.08 8:01 pm

Not sure where your reply went... I have that problem a LOT when I'm a "slightly intoxicated"

You deduce correctly that it is silentium board, and
Yeah, I know the post wasn't really about cbparser, but honestly, I figured you might have a solution.
Sorry for acting like you are free tech-support, it is just really hard to find someone to ask sh!t like this.

I have been to their forum, but even old questions go unanswered, I think the place is basically a ghostown.

Plugging in cbparser would be my dream come true solution, unfortunately I am totally clueless how to even begin.
I struggle with even simple rewrite rules like the one above, modifying the entire forum is out of my league.

On the bright side, they do give their permission to change "anything" in their README file.
So if you have time to explain how I might do it, (or waste five minutes and do it for me), I would be a very happy camper.

Heck, you already have the parser and the awesome comment script, you should just add a forum to your suite of offerings.
I bet you could make a forum script in no time that would be 100 times better anyway.
Finding a flat-file forum is as impossible as finding a decent comment script...

Cheers and Regards,
an image

PS - I probably wasn't clear about the hotlink thing, what I want is for people to be
able to post the regular forum code for thumbnails from sites like Imagevenue etc.
the codes that begin with [url= and have them display correctly as hotlinked thumbs.
EDIT: I just tested it with preview...cbparser doesn't display them either :(


cor - 04.12.08 3:44 pm

Aha! Here it is..

I said (slurred)..
The marquee is a proprietary tag. Microsoft thought it was a neat idea, and then implemented it in Internet Explorer (they assumed everyone used IE). I'm sure there are instances where it could be useful and effective on certain sites, but that's not the real issue.

I don't like to see flash in web pages, and don't use Java on-site, either, but these aren't the technologies behind the demise of these tags. The problem with proprietary tags is that, as a designer, you don't know a) if they will be supported by some other browser, and b) even if they are supported, there's no guarantee they will look anything like what you intended. This is bad for web designers and users alike. The problem with the marquee tag (and blink tag), in particular, is that it's almost universally hated. Really, lots of people find that stuff annoying. And some people simply can't read moving text.

The other problem was that back in the IE Vs Netscape days, with limited tags and unclear web standards, both crews were adding new tags every other day. Some tags were good, and were grudgingly adopted by the other side, many were not. But in reality, most modern desktop browsers support both blink and marquee tags these days, so as long as you don't mind about breaking standards, and annoying a few people (with no SEO, it will be a clique), feel free!

Designing to web standards means that, theoretically, I can create a page, and know, with a fair amount of certainty, that it will look a particular way, on all browsers. Actually, in practice, too - I was surprised, the last time I visited browsershots.org, by how remarkably similar corz.org looks on dozens of different browsers. This is definitely a good thing, and something that just wasn't possible a few years back. I keep things pretty simple; probably also has something to do with it.

Now to the money: Aside from the bandwidth (which should be unlimited and free, once connected), I think we *should* pay for everything else. Sadly, the free culture of the internet has made it extremely difficult for small developers to carve out a living - folk are so used to getting even the most expensive software for free. I love free stuff. I want software, and information, and everything that can be free, to be free. But I also want to put some money where it's due, reward good, hard work; that's how economies work.

As in many industries; TV and film, music and such, software companies have charged extortionate rates for their products. That software could cost tens of thousands of pounds is absurd. So your average guy isn't going to pay that for a program, or twenty bucks for an album; he gets a keygen, makes a tape, burns a disc, or whatever. He knows that Adobe are raking it in from corporate licensing, and sees nothing wrong with using Photoshop gratis. I don't use such apps, but I do tend to agree.

But when he applies the same thinking to those beautiful hand-crafted tool, such as one might find here at the org, he literally takes the food out of someone's mouth. For example, checksum, my best-of-class hashing app isn't the collective work of ten thousand volunteers all donating chunks of code, or the endeavours of a team of salaried software engineers; it's me, and hundreds of hours of my time, creating, conceiving, coding, web-designing, answering emails, tech support, comments, and so on; given for free. With a more balanced view of the worth of things in the net populace, people like me could actually make a living doing what we do best. If could have spent those hours working for a client, or employer, but then none of this would exist, and the Microsoft's of the world have won.

I'll carry on regardless, but aware that due to lack of consideration on the part of my guests, something's always gonna have to give. I've had to switch the comments off on many of my articles here because they were simply taking up so much time, and for no money, at all. I'm highly skilled, many say talented and more, and yet I don't even make a fraction of minimum wage from this site. If even 1% of my visitors donated just 10p, I could devote 100% of my time to putting work up here, as well as upgrade all my hardware, and have change!

One day, musicians will sell their music directly to their listeners; chat with them, get real. The prices will be way more real than now, too, and with the useless middle-third out of the equation, we'll get true, unfettered creativity from artists.

Obviously, I'm dreaming, smiley for :roll:
for now..

;o)
(or


Unexpurgated! As to your Silentum issue, firstly, I did download that board when I first read your issue, but dropping it onto two different servers and having it simply not work wasn't a good start.

Opening the php files in my text editor was bad2, use of the "short open tag" <? rather than proper <?php tags means I got no syntax highlighting, for a start (I have it set this way so that I NEVER use short open tags, because they are plain silly), which I could have fixed easily enough, even for every file, if it wasn't for the fact that they kept skipping in and out of php throughout the files, which is always infuriating, at best - they even have an .htaccess file in there, so why not at least add a php short_open_tags flag? Anyways..

That's as far as I got. But from what I remember, you have a function called basic_html(). Essentially, you include cbparser at the top of the script (probably inside function_list.php would be fine) , and then inside the .php files (run a find-in-files on your text editor) you replace every instance of the term basic_html(something) with bb2html(something). Then give it a whirl!

Or even easier than that, though a bit of a nasty hack; you could drop a cbparser call directly into the basic_html() function, here's the entire conversion..

<?php
// at the top of the document..
include ($_SERVER['DOCUMENT_ROOT'].'/site/path/to/cbparser.php');

// then inside the function..
function basic_html($text) {
    return 
bb2html($text);
    
// function's other code ignored (already returned)..
}
?>

Instructions on how to include and use cbparser are covered in greater depth inside cbparser.php itself - if you need more, open it in a text editor and have a read. If you have any issues performing the conversion, get back here with specifics, and I'll see what I can do to help.

I note we now occupy this entire page of comments! smiley for :lol:

Have fun!

;o)
(or

p.s. what's the exact code for these thumbs you are trying to post? (put it in [pre] tags) - If it's just a question of using UPPER CASE tags at the end of your post, forget posting code; there was a bug in the bbcode lowercasing function, that only affected tags at the end of your post - it's now fixed, and an updated cbparser release is available in the beta folder.


numstruck - 05.12.08 11:18 pm

Well, I gave up on using Silentium, (or even finding a flat-file forum).
I'm sure your parser would work, I'm just not good enough to hack it.

So, that actually makes the issue of thumbs moot too...
But, just as a test...

an image

Yeah, working fine now...(gotta love janice) smiley for :D

PS- If you use small tags IE: url img etc. the parser gives an "open tags" error tho.
[url=http://img143.imagevenue.com/img.php?image=16287_JanisJoplin60s_122_401lo.jpg]
[img=http://img143.imagevenue.com/loc401/th_16287_JanisJoplin60s_122_401lo.jpg][/url]

Not a big deal to me because 99.9% of everyone uses the first set of code anyway.
Anyway, enough about that (except thank-you for the updated release) smiley for :)

About the "rest" of your post...
I agree with very little of it, you may consider scrolling or blinking text annoying,
others would call it useful. Some would consider any font bigger than 12 pixels annoying
but that would be no reason to drop them from web standards. The same could be said for
colored text, or pictures or flash or backgrounds or smilies for that matter.
But there is really no point debating it, as you pointed out, they have been dropped
and yet all modern browsers will renderer them anyway. Quirks mode isn't going away
anytime soon I suspect. (At least not as long as IE is still around) lmao

About the money, well...my opinion is split.
For example, if you were selling cbparser, I wouldn't be here. I only seek out freeware.
Or, if it is a program I really want like winRAR, I just find a cracked version.
Am I hurting RARlabs? NO, because I wouldn't buy it even if a crack wasn't available.

The same can be said for any digital media, I may download an mp3 I like, but I still
wouldn't buy the song even if mp3's weren't easily available. And in my humble opinion
musicians, (and actors, and software developers, and CEO's), are obscenely overpaid.
No one, I repeat NO ONE, is worth $500,000 a week, for anything or any reason.
The fact that some people actually make that kind of money just proves to me how
distubingly unintelligent most of the human race really is.

On the other hand, I believe someone like you, creating useful tools that are above and
beyond what is available anywhere else, should be able to make a decent living doing it.
And you shouldn't have to rely on donations, but I can't think of an equitable solution
besides you going to work for a software company, or becoming webwide popular and then
start charging...which of course would lead right back to cracks and piracy.

But to be completely honest, my earlier drunken rant was mostly about ISP's trying to
change the laws so they can degrade service for everyone who doesn't pay a premium.
They want a tiered system of bandwidth, and in many places it is already happening...
it will be the end of the web as we know it, and I'm glad I'm old enough that I'll
probably die before it happens. Gawd knows the rest of the fuckin planet is too wimpy
to stand up and demand equal access for everyone.

Anyhoo, thanks again for all your help. I may yet need to hack the parser into ... well
into some sort of forum script somehow... just not sure what it might be yet.

(insert imaginary marquee tag here)
an image
(/) smiley for :)


numstruck - 05.12.08 11:33 pm

PSS. It won't let me edit my post either now, I was going to insert a line-break in the
code so it didn't break the page width, but the parser just keeps returning the preview?


cor - 06.12.08 3:37 pm

Hahah! That's ironic! You've been messing up the page formatting with every post, adding line-breaks when none are required (the column is formatted automatically), and the one place where you do need them (inside [pre] tags), you leave them out! smiley for :lol:   I'll fix that.

As for case, no lower case tags are preferable every time (if you use UPPERCASE tags, they are converted to lowercase, anyway), and will not give any errors. What DOES, or rather did give errors, is when cbparser detects the string "smilie", where it switches to legacy smiley mode (I used to misspell it, too, back when cbparser was born), and THAT is probably what messed up your ability to edit your post. I've now fixed this, so that cbparser looks for the specific string used inside legacy smiley tags, rather than just the word itself, which people obviously still use. Eventually, I'll remove all these hacks.

Back to your flat file forum. Did you read my last post? THAT is the ENTIRE conversion process! Two lines of code; one at the top (just below the <?php tags) and the other, inside the function. Copy and paste two lines. Done. I know you can do it!

On the subject of flat-file massage boards in general, there are actually quite a few of them out there - I Googled and downloaded netzbrett, eforum, puszbaza and navboard, all supporting flat-files, and mostly with their own bbcode, to boot. There are others. But if you want to stick with Silentum, two lines of code gets you cbparser bbcode.

;o)
(or

p.s. I quite like scrolling and blinking text in moderation, in the right place, I even use (XHTML-valid) blinking text elsewhere on site. But I am aware that for many people, it's a real accessibility issue. It all depends what the page is supposed to do; distraction isn't always a bad thing.


numstruck - 06.12.08 11:24 pm

Lol, yeah, I know the column is formatted, it's just habit to break my own lines.
Comes from the days before word-wrap, and using notepad for messages before posting.

I decided to try SimpleMachinesForum, it needs mySQL but if the forum gets big it is
probably a better option than having a giant text file anyway.

I have been telling a few people about Simple-Comments, so you might get a noticeable
bump in traffic to that page. (no spam, people specifically looking for a comment-script)

Anyway, just a quick stop this time...on my way to one of those "intoxicated" nights.

Cheers and Regards

an imagean imagean image


Marcus - 21.04.09 4:45 pm

Hi Cor,

First if all let me say, awesome job with the script! smiley for ;)

Im having som problems implementing the script with my blog and I hope you could help me out. To be more specific the script screwes with the new line entrys.

My text are sent to the database without converting nl2br.
I do not want any br's with the text in the database.
First when I print the database content (the post) on the blog do I run it through nr2br and the text shows up as it should in the browser.
I commented out this line in the top of the bb2html function so the script wont insert any br's for me.

$bb2html = str_replace("\r",'<br />', $bb2html);

Now when I want to edit my post, and I run it through your html2bb to view the bb code instead of html all text gets mashed togeather.
It seems to ignore my new lines in the database.

Suggestions?

Cheers!


Ensure you are using the correct form of linebreak (POST forms require "\r\n"). Also, if you are storing your text in a database, it makes sense to store it in bbcode format, and convert to HTML only for page output. ;o) Cor



Alexmos - 21.04.09 6:08 pm

how do i know if the site's admin have changed the tags?How do i find the changed tags

Ask the admin. ;o) Cor



andri - 20.02.10 10:43 am

wow... i like this script, where can i download?



Jason Drawmer - 11.11.10 12:14 pm

Brilliant script - the best bb code scripts I could find up until now were regular expression based and to be honest, not very in depth. This is great and very customisable!


Jason Drawmer - 27.04.11 11:01 am

I'm noticing with my installation of this bbcode parser, that each line space is doubled, so for each click of the return key, <br /><br /> is returned, which makes my line spaces look a bit silly! Any idea why that might be?

There's no reason why cbparser would do this. Maybe your browser is screwed. ;o) Cor



First, confirm that you are human by entering the code you see..

(if you find the code difficult to decipher, click it for a new one!)


Enter the 5-digit code this text sounds like :

lower-case ess, Upper-Case Dbl-U, thuree, lower-case aitch, Upper-Case Elle


 

Welcome to corz.org!

If something isn't working, I'm probably improving it, try again in a minute. If it's still not working, please mail me!