Log in

View Full Version : [color] code


Logikos
08-06-2004, 11:29 AM
Hey guys, i know this prolly right in from of me, but i wanted to know how i would go about using the highlight thing that is used here. If i type in a color is changes on the style, like here is red and yellow. Is this a hack, or a default option? I can't seem to find it after searching forever.

Thanks!

Xenon
08-07-2004, 12:06 PM
well, it's both ^^

actually it's very easy to achieve, you have to create an replacement called {highlight} and then just open your functions_bbcodeparse.ophp file and change
if ($vboptions['allowedbbcodes'] & ALLOW_BBCODE_COLOR)
{
// [COLOR=XXX]
$bbcodes['standard']['find']['[color='] = '#\[color=("|"|\'|)(\#?\w+)\\1\](.*)\[/color\]#esiU'; // {option} allows # and alpha-numeric
$bbcodes['standard']['replace']['[color='] = "handle_bbcode_parameter('\\3','" . str_replace("'", "\'", '<font color="\2">\3</font>') . "')";
$bbcodes['standard']['recurse']['color'][1] = array('replace_html' => '<font color="\5">\7</font>');
}


into
if ($vboptions['allowedbbcodes'] & ALLOW_BBCODE_COLOR)
{
// [COLOR=XXX]
/*$bbcodes['standard']['find']['[color='] = '#\[color=(&quot;|"|\'|)(\#?\w+)\\1\](.*)\[/color\]#esiU'; // {option} allows # and alpha-numeric
$bbcodes['standard']['replace']['[color='] = "handle_bbcode_parameter('\\3','" . str_replace("'", "\'", '<font color="\2">\3</font>') . "')";
$bbcodes['standard']['recurse']['color'][1] = array('replace_html' => '<font color="\5">\7</font>');
*/ // prevent using of color-tags, change them into high-tags instead
$bbcodes['standard']['find']['[color='] = '#\[color=(&quot;|"|\'|)(\#?\w+)\\1\](.*)\[/color\]#esiU'; // {option} allows # and alpha-numeric
$bbcodes['standard']['replace']['[color='] = "handle_bbcode_parameter('\\3','" . str_replace("'", "\'", '<font color="{highlight}">\3</font>') . "')";
$bbcodes['standard']['recurse']['color'][1] = array('replace_html' => '<font color="{highlight}">\7</font>');
}

Logikos
08-08-2004, 04:30 AM
I don't get it, i did the code change above, and when you say replacement do i go to the BB Code Manager, or Replacement Variables Manager? Kinda confised sorry.

Xenon
08-08-2004, 03:09 PM
the replacement variable manager :)

Brad
08-08-2004, 03:11 PM
It is a wonder we don't rely on replacements as much now a days, they are powerful overlooked tools.

Xenon
08-08-2004, 03:12 PM
indeed, there are a few things on vb.org just done via replacements :)

Logikos
08-08-2004, 07:46 PM
I dunno, i tried. But im still abit confused. I go into the replacement variable manager and for the master style i click [Add New Replacement Variable]


Search for Text: {color}
Replace with Text: {highlight}

Then i get this as an error:


There seems to have been a slight problem with the vBhacks.us Forum database.
Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.




Database error in vBulletin 3.0.0:

Invalid SQL:
SELECT title
FROM style
WHERE styleid =

mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3

mysql error number: 1064

Date: Sunday 08th of August 2004 01:45:24 PM
Script: http://www.domain.com/forums/admincp/replacement.php
Referer: http://www.domain.com/forums/admincp/replacement.php?do=add&dostyleid=-1
Username: LiveWire
IP Address: XX.XX.XX.XX



And i know i havn't hacked the admincp/replacement.php file. Any ideas?

Xenon
08-08-2004, 08:07 PM
the other way round.

search for {highlight}
replace with your color code.

but if you got an error that has nothing to do with us here, maybe upgrade to 3.0.3 first?

Logikos
08-08-2004, 09:36 PM
ya i should upgrade. Been dreaded doing so seeing as a have some sutom hacks that i lost the instructions to during a format =\