PDA

View Full Version : Recreate [code] tag functionality for [as], etc.


kirupa
05-09-2004, 02:56 AM
Hey everyone,
I like how the code tag retains formatting of any code entered. My problem is that in vB2, I introduced a tag for ActionScript using a 3rd party AS-code formatter. Alas, the code formatter no longer works in VB3.

So, I am trying to recreate the effects of the [ code] tag and apply to it the [as] tag feature so that the all of the code from the older threads from vb2 and earlier still display properly.

I tried going to the bb code manager and entering: [ code]{param}[/ code] for the [as] tag, but the [ code ] was simply not interpreted. I was informed at vbulletin.com to post my request here instead.

Does anybody have any similar solutions? Thanks!

Cheers!
Kirupa

kirupa
06-16-2004, 04:10 PM
Let's not all jump in and answer at the same time :)

Is there a way though? I tried various methods to trick vB into thinking that [as] would be seen as PHP, but that did not work well.

Thanks!
Kirupa

Xenon
06-16-2004, 04:22 PM
well, you have to edit functions_bbcodeparse.php there are the code-html... tags defined.

you have to create an code handler function, depending on the third party script code :)

kirupa
06-16-2004, 04:25 PM
Thanks Xenon! I will give that a shot :)

kirupa
06-17-2004, 12:29 AM
Do you happen to know of a guide or forum post that outlines how to accomplish that? I looked through that PHP file and it is overwhelming.

I am not interested in re-creating the AS effect at this point. All I would like to do is display the same results when a user types as when a user types [ code ] [/ code]

Thanks!
Kirupa

Xenon
06-17-2004, 05:41 PM
ahh, well that's quite easy then :)

in functions_bbcodeparse.php find:
$bbcodes['custom']['find']['[code]'] = '#\[code\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/code\]#esiU';
$bbcodes['custom']['replace']['[code]'] = "handle_bbcode_code('\\2')";
$bbcodes['custom']['recurse']['code'][0] = array('handler' => 'handle_bbcode_code');


and below just add:
$bbcodes['custom']['find']['[as]'] = '#\[as\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/as\]#esiU';
$bbcodes['custom']['replace']['[as]'] = "handle_bbcode_code('\\2')";
$bbcodes['custom']['recurse']['as'][0] = array('handler' => 'handle_bbcode_code');

marc_t
06-17-2004, 07:05 PM
Thanks... will check it right now. Is this also working with the php-Code?

It is not the solution I wanted in original, but for now, if it is working, it gives time to try finding a better way..

marc_t
06-17-2004, 07:46 PM
Hi, made this one with the php Tag. Is working fine. Duplicated the section with bbcode_php and made a new template to have the code marked as "ActiionScript".

Any idea how I can make codelines indented?

Thanks so far!
marc

kirupa
06-18-2004, 12:18 AM
Xenon - that worked brilliantly! Now, I duplicated a PHP-like section, duplicated a bbcode_as template, and everything works. And, now, where are the color-coding for PHP defined? For I would like to color code the AS tags, and I would like to duplicate the PHP color codes and modify it slowly as time progresses.

Thanks!
Kirupa :)

Xenon
06-18-2004, 10:49 AM
well, the color coding of php isn't a thing vbulletin brought in, it's something build in in PHP itself.

best hint for ya is to take a close look at the html code handler in the functions_bbcodeparse.php file, so you can find out how the html tag works and then rewrite that for the as tags :)