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

Wrong parsing BB code

#1
Help me , where I'm doing wrong!
PHP:
$viewParams = array(
            'enter => $resDbConnect->getValue(//receive data array ),
                         .........
                        );
return $this->responseView('MyAddOns_Enter_ViewPublic_EnterHome_Index','enter_my_home' , $viewParams,);
In MyAddOns_Enter_ViewPublic_EnterHome_Index
PHP:
class MyAddOns_Enter_ViewPublic_EnterHome_Index extends XenForo_ViewPublic_Base
{

    public function renderHtml()
    {
        $this->parseBBCodeInEnter();
    }
  
    private function parseBBCodeEnter()
    {
        $bbCodeOptions = array(
            'states' => array(
                'viewAttachments' => true
            )
          
        );      
      
        $bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
        $this->_params['enter']['messageHtml'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['enter'], $bbCodeParser, $bbCodeOptions);
  
    }

parsing the template
PHP:
<xen:foreach loop="$entryy" key="$kk" value="$en" >
   {xen:raw $en.enter.messageHtml}
</xen:foreach>
Finally my fault
Fatal error: Can not use object of type XenForo_BbCode_TextWrapper as array in
 

Jake B.

Well-known member
#2
You're missing a single quote.

Code:
           'enter => $resDbConnect->getValue(//receive data array ),
should be
Code:
           'enter' => $resDbConnect->getValue(//receive data array ),
Assuming the comment you have in there is a placeholder. Otherwise, you'll want to put the end parenthesis on a new line.
 
#3
You're missing a single quote.

Code:
           'enter => $resDbConnect->getValue(//receive data array ),
should be
Code:
           'enter' => $resDbConnect->getValue(//receive data array ),
Assuming the comment you have in there is a placeholder. Otherwise, you'll want to put the end parenthesis on a new line.
Code:
'enter => $resDbConnect->getValue(),
still not working:(