954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to set up a textarea that accepts tags like [CODE] , [IMG]

How to set up a textarea that accepts tags like

" [IMG] , [QUOTE] , [CODE] "

using php

vijaysoft1
Junior Poster in Training
81 posts since Jun 2008
Reputation Points: 10
Solved Threads: 0
 

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 .

hireaprogrammer
Junior Poster in Training
95 posts since Jul 2009
Reputation Points: 9
Solved Threads: 1
 

Use google and search for bbcode classes.

kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
 

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');
diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 
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.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

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.

kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
 

preg_replace gives me the cr[e]ep$.

diafol
Rhod Gilbert Fan (ardav)
Moderator
7,792 posts since Oct 2006
Reputation Points: 1,170
Solved Threads: 1,080
 
preg_replace gives me the cr[e]ep$.


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

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 259
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You