1. 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

Discussion in 'Styling and Customization Questions' started by Nudaii, May 27, 2014.

  1. Nudaii

    Nudaii Well-Known Member

    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 .
  2. Brogan

    Brogan XenForo Moderator Staff Member

    It should be simple enough with a PHP callback.
  3. Nudaii

    Nudaii Well-Known Member

    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.
  4. Chris D

    Chris D XenForo Developer Staff Member


    class YourAddOn_Path
        public static function 
    tagYourTag(array $tag, array $rendererStatesXenForo_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.
    Nudaii likes this.

Share This Page