vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   php BB code (https://vborg.vbsupport.ru/showthread.php?t=70789)

Barrikin 10-19-2004 11:13 PM

php BB code
 
I want to be able to use [php=thefilename.php]

So it puts a lenged for the table. Kinda like a quote tag.

What would the best way to go about this?

I think all the bb code functions should be handle within the admincp.

Xenon 10-20-2004 05:35 PM

well some functions cannot be handled just within the acp, as the code highlighting is not doable with plain html, but needs some php.

but actually it's not hard to achieve something similar,

look into include/functions_bbcodeparse.php

you can see there how the quote code is handled (take a closer look at the $username parameter) and just add the same things to the php tag part of the code :)

Barrikin 10-21-2004 12:22 AM

I've look and found this
PHP Code:

// [QUOTE]
    
$bbcodes['custom']['find']['[quote]'] = '#\[quote\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/quote\]#esiU';
    
$bbcodes['custom']['replace']['[quote]'] = "handle_bbcode_quote('\\2')";
    
$bbcodes['custom']['recurse']['quote'][0] = array('handler' => 'handle_bbcode_quote');

    
// [QUOTE=XXX]
    
$bbcodes['custom']['find']['[quote='] = '#\[quote=(&quot;|"|\'|)(.*)\\1\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/quote\]#esiU';
    
$bbcodes['custom']['replace']['[quote='] = "handle_bbcode_quote('\\4', '\\2')";
    
$bbcodes['custom']['recurse']['quote'][1] = array('handler' => 'handle_bbcode_quote'); 

[php]
// [PHP] - this is the first custom tag because it does weird things to HTML
$bbcodes['custom']['find']['[php]'] = '#\[php\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/php\]#esiU';
$bbcodes['custom']['replace']['
PHP Code:

'] = "handle_bbcode_php('\\2')";
        $bbcodes['
custom']['recurse']['php'][0] = array('handler' => 'handle_bbcode_php'); 

So how would i go about this?

Barrikin 10-21-2004 12:25 AM

I guess i'd use something like this?

PHP Code:

// [QUOTE=XXX]
    
$bbcodes['custom']['find']['[php='] = '#\[php=(&quot;|"|\'|)(.*)\\1\](<br>|<br />|\r\n|\n|\r)??(.*)(<br>|<br />|\r\n|\n|\r)??\[/php\]#esiU';
    
$bbcodes['custom']['replace']['[php='] = "handle_bbcode_php('\\4', '\\2')";
    
$bbcodes['custom']['recurse']['php'][1] = array('handler' => 'handle_bbcode_php'); 

Not sure if i'm even close. lol

Xenon 10-21-2004 10:43 AM

exactly, you are very closed.

add that code block under the old php code.

but your not done yet, you have to change the handle_bbcode_php function to accept an optional parameter, and then just put the optional parameter into the bbcode_php template.

try to find out how to do it.
If you won*'t find it, i can tell you when i'm back from university :)

Barrikin 10-22-2004 10:21 AM

Allright, i got it working.. Thanks alot :)

Xenon 10-22-2004 04:06 PM

you're welcome :)


All times are GMT. The time now is 08:22 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.01141 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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