Construcción de foros php, barra de configuración de entrada (negrita,... enlaces... etc.), ¿cómo aplicar?

Ok , so I am creating a forum, I have successfuly installed the BBcodeParser PEAR package, everything works perfectly.

Now when someone wants to write a new topic, he has a bar, to turn text into bold for example.

Now how can I apply the BBcode based on the user's request?. (for example , when he marks some text and clicks on the [B] button, how can I make that text bold?)

It sounds simple to me, I just add [b] before , and [/b] after that text he marked, but I realy need a hint on where to start , and do I need javascript? , should I do it with buttons or hyperlinks?

And when he clicks the B button, I dont want to refresh the whole page...

Muchas gracias por adelantado por su ayuda.

preguntado el 29 de junio de 12 a las 20:06

You would need to use javascript. I added the javascript tag to your post -

1 Respuestas

It's simple and clear. When you want to do something depending upon some user action you need javascript. And to make it much easier, you could use some javascript library (my fav jQuery). It's good to write your own code if you really want to learn but there are plenty of plugins available for what you want to do. Both in php and javascript. With javascript you can generate quick preestreno of what user is entering and with php you can parse the shortcodes (like [b]I'm bold[/b] into equivalent I'm bold and store it in database for future uses. I'd suggest you to google and start from there. Study the editor provided here on stackoverflow. Much lighter than other alternatives available but still rich in usability.

Respondido el 29 de junio de 12 a las 20:06

Thanks for the reply :) I will - sombreado

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.