vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Recreate [code] tag functionality for [as], etc. (https://vborg.vbsupport.ru/showthread.php?t=64896)

kirupa 05-09-2004 02:56 AM

Recreate [code] tag functionality for [as], etc.
 
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][/as] 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:
PHP Code:

        $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:
PHP Code:

        $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 :)


All times are GMT. The time now is 07:14 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01220 seconds
  • Memory Usage 1,733KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete