Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 10-19-2004, 11:13 PM
Barrikin Barrikin is offline
 
Join Date: Jun 2004
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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.
Reply With Quote
  #2  
Old 10-20-2004, 05:35 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #3  
Old 10-21-2004, 12:22 AM
Barrikin Barrikin is offline
 
Join Date: Jun 2004
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 10-21-2004, 12:25 AM
Barrikin Barrikin is offline
 
Join Date: Jun 2004
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #5  
Old 10-21-2004, 10:43 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 10-22-2004, 10:21 AM
Barrikin Barrikin is offline
 
Join Date: Jun 2004
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Allright, i got it working.. Thanks alot
Reply With Quote
  #7  
Old 10-22-2004, 04:06 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you're welcome
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:08 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03799 seconds
  • Memory Usage 2,225KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete