• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 BBCode for random number

Nudaii

Well-known member
#1
would it be possible to have a bbcode that displays a random number between say 1-20?



I have seen it done before but unsure if poissible on xf .
 

Nudaii

Well-known member
#3
ah php callbacks i haven't worked with yet with bbcode, sis there a guide someplace? i looked but couldn't find one.

also would it be possible to not have the number constantly update on every page load?

i am using it to place a random "questcard" for an rpg type game.
 

Chris D

XenForo developer
Staff member
#4
PHP:
<?php

class YourAddOn_Path
{
    public static function tagYourTag(array $tag, array $rendererStates, XenForo_BbCode_Formatter_Base $formatter)
    {
        // return some HTML (or a template object)
        return '<b>123456</b>';
    }
}
That's an incredibly simplistic example of what a BB Code callback should look like.

The file would be located in library/YourAddOn/Path.php

You can see how XenForo does its own BB Codes in XenForo/BbCode/Formatter/Base.php.