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

XF 1.4 BBCode tags with variant options

Discussion in 'XenForo Questions and Support' started by Warren Block, Oct 21, 2014.

  1. Warren Block

    Warren Block Member

    With phpBB, we were able to define two variations of a tag depending on whether an option was given. For example:
    Refer to [man]ls[/man].
    Refer to [man=1]ls[/man].
    Both the display of the contents and the URL link generated were different:

    Refer to ls.
    Refer to ls(1).

    XenForo does BBCode differently, and this is the current definition we have for the HTML replacement:
    <a target="_blank" title="A mysterious {text}({option}) manual page" href="https://www.example.org/cgi/man.cgi?query={text}&sektion={option}">{text}({option})</a>
    This renders the parens even when the optional parameter is not given, and includes them in the links:

    Refer to ls().
    Refer to ls(1).

    The first looks confusingly like a function call. What is the XenForo way to not include the extra characters when the optional parameter is not included?
  2. Mike

    Mike XenForo Developer Staff Member

    To take different paths with an option specified, you'd generally need to use a callback for rendering.
  3. Warren Block

    Warren Block Member

    Could you point me to an example?

Share This Page