Page 1 of 1
bbCode into php site
Posted: Sun Jul 29, 2007 7:29 pm
by trassalg
Can anyone recommend a simple way of implementing bbcode into a php-based website/database design? I'd like the user to be able to enter the data using bbcode's options (simple click and format options without having to know anything about code... like this site has) and have this display in pages when the results are pulled out of the database and displayed in HTML format.
Posted: Sun Jul 29, 2007 7:38 pm
by superdezign
Simple? You are asking for both bbCode parsing and JavaScript-controlled entry into the textarea.
Is there any one part in particular that you are after?
Posted: Sun Jul 29, 2007 11:46 pm
by trassalg
Was wondering what the "standard" way of going about this would be from others with more experience in it. I'm pretty much clueless as to what tools I'd need to implement to do so, but know there are quite a few open source bbcode projects out there. Just didn't know if there was a fairly user friendly version.
Posted: Mon Jul 30, 2007 12:49 am
by iknownothing
on a quick search I found this:
http://pear.php.net/package/HTML_BBCodeParser
Didn't look much into it, but it appears to be something like what you are looking for.
If it is not, then I think that all the code translations will have to be done yourself using string replace functions and the like with PHP.
I believe that the click buttons you mentioned, assuming you mean (Bold, Italic, Underline etc) do not come with this, and forums such as this one have had the various buttons coded into them, with use of Javascript.
For example, 100% completely untested...
Code: Select all
function doBold() {
var OnOffBold;
if (OnOffBold = "0"){
thetext.innerHTML += '[b]';
OnOffBold = "1"
}
if (OnOffBold = "1"){
thetext.innerHTML += '[/b]';
OnOffBold = "0"
}
}
Code: Select all
//BOLD Button
<input type="button" name="bold" value="B" onclick="doBold();">
<textarea name="thetext"></textarea>
[/syntax]