1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

As Designed No text formatting / line breaks in recent reviews

Discussion in 'Showcase Resolved Bug Reports' started by kontrabass, Dec 4, 2015.

  1. kontrabass

    kontrabass Member AMS Premium CAS Premium RMS Premium SC Premium

    Hi Bob, I LOVE the new "recent reviews" on the item page. One small thing though, it seems that line breaks and bbcode are not parsed - therefore the user review looks like one big blob of text (see this item for example).

    Switched to default xf style, no change.

    :)
     
  2. Bob

    Bob Developer Staff Member

    This is as designed (ON PURPOSE) (similar to the sidebar blocks that are also not parsed). The summary is only fully parsed on the Reviews Tab right now. My plan was to add parsing once I had time to develop the new review block template that has expanding functionality (to hide LONG reviews.... yano, similar to Amazon).

    I'll turn parsing on in the next release and in the mean time, if you want to do it on your own, you can via a file edit (one of the VIEW files).

    Edit file: /library/NFLJ/Showcase/ViewPublic/Item/View.php

    Add this directly under the comments parsing block:
    PHP:
            if ($this->_params['reviews'])
            {
                
    $reviewParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
                   
                foreach (
    $this->_params['reviews'] AS $itemReviewId => $itemReview)
                {
                    
    $temp['message'] = XenForo_Helper_String::bbCodeStrip($itemReview['pros_message']);
                    
    $itemReview['pros_message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($temp$reviewParser);
           
                    
    $temp['message'] = XenForo_Helper_String::bbCodeStrip($itemReview['cons_message']);
                    
    $itemReview['cons_message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($temp$reviewParser);
           
                    
    $temp['message'] = $itemReview['summary_message'];
                    
    $itemReview['summary_message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($temp$reviewParser);
           
                    
    $this->_params['reviews'][$itemReviewId] = $itemReview;
                }
            }
    Result will look like this:
    PHP:
    <?php

    class NFLJ_Showcase_ViewPublic_Item_View extends XenForo_ViewPublic_Base
    {
        public function 
    renderHtml()
        {
            
    XenForo_Application::set('view'$this);
           
            
    $this->_params['editorTemplate'] = XenForo_ViewPublic_Helper_Editor::getEditorTemplate(
                
    $this'message'$message '',
                array(
                    
    'height' => '100px',
                    
    'extraClass' => 'NoAttachment',
                    
    'json' => array('placeholder' => new XenForo_Phrase('nflj_showcase_write_a_comment'))
                )
            );       

            
    $bbCodeParser XenForo_BbCode_Parser::create(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
            
    $bbCodeOptions = array(
                
    'states' => array(
                    
    'viewAttachments' => $this->_params['item']['canViewAttachments']
                )
            );

            
    $this->_params['item']['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['item'], $bbCodeParser$bbCodeOptions);
            
    $this->_params['t2']['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['t2'], $bbCodeParser$bbCodeOptions);
            
    $this->_params['t3']['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['t3'], $bbCodeParser$bbCodeOptions);
            
    $this->_params['t4']['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['t4'], $bbCodeParser$bbCodeOptions);
            
    $this->_params['t5']['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($this->_params['t5'], $bbCodeParser$bbCodeOptions);   
           
            if (
    $this->_params['comments'])
            {
                foreach (
    $this->_params['comments'] AS $itemCommentId => $itemComment)
                {
                    
    $itemComment['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($itemComment$bbCodeParser);
                   
                    foreach (
    $itemComment['replys'] AS $commenReplytId => $commentReply)
                    {
                        
    $commentReply['message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($commentReply$bbCodeParser);
                   
                        
    $itemComment['replys'][$commenReplytId] = $commentReply;
                    }               

                    
    $this->_params['comments'][$itemCommentId] = $itemComment;
                }
            }
           
            if (
    $this->_params['reviews'])
            {
                
    $reviewParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
                   
                foreach (
    $this->_params['reviews'] AS $itemReviewId => $itemReview)
                {
                    
    $temp['message'] = XenForo_Helper_String::bbCodeStrip($itemReview['pros_message']);
                    
    $itemReview['pros_message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($temp$reviewParser);
           
                    
    $temp['message'] = XenForo_Helper_String::bbCodeStrip($itemReview['cons_message']);
                    
    $itemReview['cons_message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($temp$reviewParser);
           
                    
    $temp['message'] = $itemReview['summary_message'];
                    
    $itemReview['summary_message'] = XenForo_ViewPublic_Helper_Message::getBbCodeWrapper($temp$reviewParser);
           
                    
    $this->_params['reviews'][$itemReviewId] = $itemReview;
                }
            }
        }
    }
     
  3. kontrabass

    kontrabass Member AMS Premium CAS Premium RMS Premium SC Premium

    Thanks Bob! Really appreciate the updates :)
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.