View Full Version : Adding vB code
I want to be able to add a color code in the vB code so that someone can just type in [ color=yourcolor ]Your text is now yourcolor [ /color ]. Looks like this would have to be hard coded in the global.php file.
Any ideas?
Parker
I added code for alot of colors like [ red ] [ /red ], etc but to do what you want you would have to hack it in.
Yep that is what I wanting to do hack it in.
Any idea on the code to use?
Parker
Are you wanting it to be [ color=red ] or [ color=#ffffff ] as the first would require a finite list of colors for the user to choose from unless there is some function that 'understands' english color names and knows how to translate them to the appropiate hex code.
[Edited by rangersfan on 07-12-2000 at 12:29 PM]
What I am wanting it to do is use the normal
< font color=xxx > Your text changes color here < /font >
but do so with vB code with the [ color=xxx ] your text colored here [ /color ]. Ofcourse there are not spaces in the brackets.
In UBB the code is:
(\[COLOR=)(.+?)(])(.+?)(\[\/COLOR\])/<font color="$2">$4<\/font> /isg;
Parker
Ok I figured it out partially.
In global.php put
// do color
$bbcode=eregi_replace("\\[color=([^\"]*)\\]([^\\[]*)\\[\\/color\\]","<font color=\"\\1\">\\2</font>",$bbcode);
but it will only allow the color tag to be used once. If you put in a color tag followed by another color tag it will use the last one in the list and not the one above it and it screws the colors up.
You can use a traditional font tag before the color tag and they both work but if you use say two font tags and then a color tag and then another font tag and then a color tag the font tags show up ok but the color tag just shows you the last one.
Parker
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.