How to set up a textarea that accepts tags like

 "  (IMG)  , (QUOTE) , (CODE) "

using php

You can do if you know V bulletin Forum Programming ..it is ready made code available in it ..that's part of Text area editor that's called Forum editor ..I hope that's help you ...Thank you .

Use google and search for bbcode classes.

Member Avatar for diafol

Judging by your other thread, you're building a text editor for something like a forum/blog.

http://www.phpclasses.org/browse/package/951.html is a good lightweight class. However you need to register/login to download.

It has a mistake though, change line 2 from:

require_once('bbcode.php');

to:

require_once('bbcode.inc.php');

Use google and search for bbcode classes.

Why use classes when one long line of preg_replace will do the job. Using preg_replace once for the job will do the job better then what any class will ever do.

Classes give more functionality and flexibility. They just make it easier to add specialized tags without having to deal with editing regular expressions, which can be a pain in the a**.

preg_replace is just fine, I just didn't suggest it because I wouldn't use a regex.

Member Avatar for diafol

preg_replace gives me the cr[e]ep$.

preg_replace gives me the cr[e]ep$.

Well I find preg_reglace and regex to be fun, easy but almost useless.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.