Trim and BBCode

BUT TO BE HONNEST:
I would make this in a own view and not in the template
 
And do you have a valid parser object?
I bet no;)
parser object? See I'm still new to the bbcode conversion with XenForo, had it all figured out for vB.

I'm not even sure where to start on making this work in own view.
 
After reviewing the BBCode portion of latest posts, I decided it would be best to follow ragtek and strip the bbcode so that it displays pretty and not seem so ugly.
 
You have to parse BBcode in the VIEW. Yes, you could parse it in the model, but its a little hacky and you will get problems later on... The code below will look through an array ($posts in this case), foreach $posts AS $post and bbcode $post['message']. This is the best routine for parsing MULTIPLE posts.
Code:
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
XenForo_ViewPublic_Helper_Message::bbCodeWrapMessages($posts, $bbCodeParser);

If you would like to parse a SINGLE post... try this:
Code:
$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
$this->_params['post']['HTML'] = new XenForo_BbCode_TextWrapper($this->_params['post']['message'], $bbCodeParser);
 
Top Bottom