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

Accept BB code in a generic text input and render as HTML

Discussion in 'XenForo Development Discussions' started by Chris D, Jul 21, 2012.

  1. Chris D

    Chris D XenForo Developer Staff Member

    I want to put a generic text input box in a template which, on submission, then puts that input into the database.

    I can do that, no problem.

    What I want is for the text box to be able to accept BB code and when the contents of this text box is rendered somewhere, it should render it as HTML.

    I vaguely remember seeing somewhere how XenForo handles this for posts, but I can't remember for the life of me where.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That is done in the view. See this class for a code example:


    There is a helper and everything.
  3. Chris D

    Chris D XenForo Developer Staff Member

    Thank you Jake,

    I'm struggling a little bit on this one :(

    I might have implemented it wrong, but I'm getting:

    An exception occurred: Undefined index: message in C:\wamp\www\library\XenForo\ViewPublic\Helper\Message.php on line 19
    Which kinda makes sense because it's not a message I'm trying to view.

    Although not exactly what I'm trying to achieve, I guess the way I'm thinking about it is if you consider Kier's old scratchpad add-on:


    What I want to do is whatever you'd need to do for that text input box to accept and then render BB Code.

Share This Page