Jump to content

BBcodes automaticly converted inside textarea

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
webcodez

webcodez

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Hi there,

How can I get bbcodes automaticly converted INSIDE THE TEXTAREA. So, like with vBulletin e.g., the text is already bold shown inside the textarea, or links are already shown as links inside the textarea, etc..

How to do this? Is it complex to accomplish?

Thanks in advanced! :)

Cheers.

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
yea man.. I think it wont be easy to make something like this.. You have to use some kind of javascript or jquery..

#3
webcodez

webcodez

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Seems like I need a 'WYSIWYG' editor, and googled it: vBulletin uses htmlarea? They just use pre-made WYSIWYG editors from internet? o.O

EDIT: seems like I'll need to use a WYSIWYG editor like TinyMCE.

#4
webcodez

webcodez

    Programmer

  • Members
  • PipPipPipPip
  • 149 posts
Trying out FCKeditor now but seem not to use BBCodes but only HTML codes instead. So what I just done was replacing them by bbcodes like this:

<(.*)>

by

[\$1]

Though that would replace all <anythings> by [anythings] even when it's not meant to but I think people won't put things between < and > anyway but yeah, I could also make a list of all bbcodes and replace all those corresponding html codes with those but then I'm afraid for vulnerability as there might be html codes left or wouldn't that matter if I just use htmlspecialchars?

Would it be a 'good' way to just replace the html tags / codes by bbcodes? ( either all or only the existing/valid html/bbcodes )

Thanks in advanced.

btw, got it working but not sure if it isn't vulnerable.

EDIT: also seems that the editor automaticly puts this as code inside the textarea:

<html>
 <head>
  <title></title>
 </head>
 <body></body>
</html>

=/ all based on html codes... could just all change them by bbcodes and try remove this from standard code but not sure if that's the right way.