
October 9th, 2003, 09:41 AM
|
|
Contributing User
|
|
Join Date: Jul 2003
Posts: 367
Time spent in forums: 7 m 21 sec
Reputation Power: 6
|
|
I'm not totally sure what you're after but presume you want some kind of tagging system (without allowing html) that can be used to 'mark up' text typed into a textarea.
A simple start to this is to create two arrays, one holding the tags you want to have used in the textareas and the second containing what you want them to be replaced by.
Then the contents of the textarea can be passed through the function str_replace with those two arrays and it'll do all the replacements for you.
Example -
PHP Code:
$search = array ('*b*', '*/b*');
$replace = array ('<b>', '</b>');
echo str_replace ($search, $replace, $message);
Using this method you can create any number of 'emphasis' tags or whatever you like and make a single replacement. If you're more serious about doing this you can hold a list of all of them in a database or textfile rather than hardcoding them then dynamically build the arrays from that.
Hope this helps,
-KM-
|