Просмотр исходного кода

#1 - Minor fixes and improvements.

AntonLV 12 лет назад
Родитель
Сommit
a7ea051bd1
2 измененных файлов с 5 добавлено и 8 удалено
  1. 1 1
      inc/classes/BxDolCmts.php
  2. 4 7
      template/scripts/BxBaseCmts.php

+ 1 - 1
inc/classes/BxDolCmts.php

@@ -680,7 +680,7 @@ class BxDolCmts extends BxDol implements iBxDolReplaceable
         $sCmtDisplay = isset($_REQUEST['CmtDisplay']) ? bx_process_input($_REQUEST['CmtDisplay'], BX_DATA_TEXT) : '';
         $sCmtFilter = isset($_REQUEST['CmtFilter']) ? bx_process_input($_REQUEST['CmtFilter'], BX_DATA_TEXT) : '';
 
-        return $this->getComments(array('vparent_id' => $iCmtVParentId, 'start' => $iCmtStart, 'per_view' => $iCmtPerView, 'type' => $sCmtBrowse, 'filter' => $sCmtFilter), array('type' => $sCmtDisplay));
+        return $this->getComments(array('vparent_id' => $iCmtVParentId, 'start' => $iCmtStart, 'per_view' => $iCmtPerView, 'type' => $sCmtBrowse, 'filter' => $sCmtFilter), array('type' => $sCmtDisplay, 'show_empty' => true));
     }
 
     public function actionSubmitPostForm()

+ 4 - 7
template/scripts/BxBaseCmts.php

@@ -79,17 +79,14 @@ class BxBaseCmts extends BxDolCmts
     function getCommentsBlock($iParentId = 0, $iVParentId = 0, $bInDesignbox = true)
     {
         $aBp = array('parent_id' => $iParentId, 'vparent_id' => $iVParentId);
-
-        $sCmts = $this->getComments($aBp);
-        if(empty($sCmts))
-            $sCmts = $this->_getEmpty();
+        $aDp = array('show_empty' => true);
 
         $sCaption = _t('_cmt_block_comments_title', $this->getCommentsCount());
         $sContent = BxDolTemplate::getInstance()->parseHtmlByName('comments_block.html', array(
             'system' => $this->_sSystem,
             'list_anchor' => $this->getListAnchor(),
             'id' => $this->getId(),
-            'comments' => $sCmts,
+            'comments' => $this->getComments($aBp, $aDp),
             'post_form_top' => $this->getFormBoxPost($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP)),
             'post_form_bottom'  => $this->getFormBoxPost($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM)),
         	'view_image_popup' => $this->_getViewImagePopup(),
@@ -117,8 +114,8 @@ class BxBaseCmts extends BxDolCmts
 
         $aCmts = $this->getCommentsArray($aBp['vparent_id'], $aBp['filter'], $aBp['order'], $aBp['start'], $aBp['per_view']);
         if(empty($aCmts) || !is_array($aCmts))
-            return '';
-
+            return isset($aDp['show_empty']) && $aDp['show_empty'] === true ? $this->_getEmpty() : '';
+            
         $sCmts = '';
         foreach($aCmts as $k => $aCmt)
             $sCmts .= $this->getComment($aCmt, $aBp, $aDp);