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

Wrong parsing BB code

Discussion in 'XenForo Development Discussions' started by Hugilore111, Apr 8, 2016.

  1. Hugilore111

    Hugilore111 Member

    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="$entryykey="$kkvalue="$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
     
  2. Jake B.

    Jake B. Well-Known Member

    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.
     
    Hugilore111 likes this.
  3. Hugilore111

    Hugilore111 Member

    Code:
    'enter => $resDbConnect->getValue(),
    still not working:(
     
  4. Jake B.

    Jake B. Well-Known Member

    You're still missing the quote.
     
  5. Hugilore111

    Hugilore111 Member

    Code:
    'enter' => $resDbConnect->getValue(),
    comma changed correctly
    I misspelled here
    Dont work
     

Share This Page