vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   adding new bbcode (https://vborg.vbsupport.ru/showthread.php?t=100995)

sabret00the 11-17-2005 10:53 AM

adding new bbcode
 
could someone tell me how to do it.

i should just be able to add the new function, add to the tag_list, throw in a new template and voila. however i'm not sure where the hook is for the functions (and i'm hoping that's what's causing me all the errors i'm getting because i am getting a few).

sabret00the 11-19-2005 08:24 AM

*bump*

vtx1800 11-19-2005 09:14 AM

What are you trying to add? I did a few, seemed to be easy.

Marco van Herwaarden 11-19-2005 10:47 AM

Hehe, i also don't have a clue what he is asking. :d

sabret00the 11-19-2005 11:01 AM

i want to add a bbcode via the class because of the fact it requires back-end processing, however in the old version.

i'd simply find each instance of the quote being created and add my relative code underneath that, however with the new plugin system that's not quite possible.

so i'm wondering how i'd add bbcode.

i've added the taglist stuff, now i've just gotta add the function but not sure what hook to use for that.

vtx1800 11-19-2005 11:20 AM

In the custom BB code area, you can set the BBcode var, and the html to use for that var. you use {param} as the var in the html. Example:

Code:

[test]Testvar[/test]

In the ACP, your html would be <a href='http://www.domain.com/user/{param}'>My Profile</a>

Then when the code is used, it will return <a href='http://www.domain.com/user/Testvar'>My Profile</a>


sabret00the 11-19-2005 11:45 AM

the version require php processing

PHP Code:

// [SPOILER]
        
$tag_list['no_option']['spoiler'] = array(
            
'callback' => 'handle_bbcode_spoiler',
            
'strip_empty' => true,
            
'strip_space_after' => 1
        
);

        
// [SPOILER=XXX]
        
$tag_list['option']['spoiler'] = array(
            
'callback' => 'handle_bbcode_spoiler',
            
'strip_empty' => true,
            
'strip_space_after' => 1,
            
'parse_option' => true
        
); 

this one uses the bbcode_fetch_tags plugin

but i still need to find the hook for the function
PHP Code:

/**
    * Handles a [spoiler] tag. Displays a string in an area indicating it was a spoiler.
    *
    * @param    string    The body of the quote.
    * @param    string    If tag has option, then a reason is present.
    *
    * @return    string    HTML representation of the tag.
    */
    
function handle_bbcode_spoiler($message$reason '')
    {
        global 
$vbulletin$vbphrase$stylevar$show;

        
// remove smilies from username
        
$reason $this->strip_smilies($reason);
        
$show['reason'] = ($username != '') ? TRUE FALSE);
        
$message $this->strip_front_back_whitespace($message1);

        if (
$this->options['cachable'] == false)
        {
            
$show['iewidthfix'] = (is_browser('ie') AND !(is_browser('ie'6)));
        }
        else
        {
            
// this post may be cached, so we can't allow this "fix" to be included in that cache
            
$show['iewidthfix'] = false;
        }

        
$template 'bbcode_spoiler';
        eval(
'$html = "' fetch_template($template) . '";');
        return 
$html;
    } 


El_Muerte 12-19-2005 07:33 AM

*bump*

anyone have a solution for this yet?

I also need to add a bbcode tag that has a callback

the problem is that the vbcode parser calls $this->$callback(...)

I don't want to edit the original file for this hack

merk 12-19-2005 08:15 AM

You can define it as a user function (which youll need to call using a calling function) in the _start hook for the class. (i think)

El_Muerte 12-19-2005 10:18 AM

Ah figured it out

PHP Code:

$tag_list['no_option']['mytag'] = array(
    
'callback' => 'handle_external',
    
'external_callback' => 'handle_bbcode_mytag',
    
'strip_empty' => true,
);

function 
handle_bbcode_mytag($parser$param$option)
{




All times are GMT. The time now is 02:58 PM.

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.01026 seconds
  • Memory Usage 1,752KB
  • 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
  • (1)bbcode_code_printable
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete