پارس جوم ::  انجمن های تخصصی جوملا
بهبود جدول خروجی کامپوننت DJ Catalog 2 - نسخه‌ی قابل چاپ

+- پارس جوم :: انجمن های تخصصی جوملا (https://forums.parsjoom.ir)
+-- انجمن: پشتیبانی (/forum-70.html)
+--- انجمن: مباحث و مشکلات عمومی (/forum-33.html)
+--- موضوع: بهبود جدول خروجی کامپوننت DJ Catalog 2 (/thread-20881.html)



بهبود جدول خروجی کامپوننت DJ Catalog 2 - moussa75 - ۵-۶-۱۳۹۶ ۰۸:۳۵ عصر

با سلام
من از کامپوننت DJ Catalog 2 استفاده می کنم و می خوام جدول خروجی فیلدها دسته بندی باشد. مانند
گروه فیلد 1
فیلد 1-1
فیلد 1-2
گروه فیلد 2
فیلد 2-1
فیلد 2-2
و ایضا. اما این در حالی است که جدول خروجی کامپوننت DJ Catalog 2 تمام فیلدها را در یک جدول نشان می دهد. کد php فایل مربوطه پیوست کردم لطفا راهنمایی کنید چگونه از دستور if یا دستورات حلقه استفاده کنم.

کد php:
<?php
defined 
('_JEXEC') or die('Restricted access'); 
?>
<?php
$attribute 
$this->attribute_cursor
$attributeName '_ef_'.$attribute->alias
?>
<?php 
if (!empty($this->item_cursor->$attributeName)) { ?>
<?php 
if ($attributeName=='_ef_engine_type' || $attributeName=='_ef_engine_size'){ ?>
           <a>گروه فیلد 1</a>
<tr class="djc_attribute djc<?php echo $attributeName?>">
         
    <td class="djc_label">
    <?php 
        
if ($attribute->imagelabel != '') {
            echo 
'<img class="djc_attribute-imglabel" alt="'.htmlspecialchars($attribute->name).'" src="'.JURI::base().$attribute->imagelabel.'" />';
        }     
        else {
            echo 
'<span class="djc_attribute-label">'.htmlspecialchars($attribute->name).'</span>';
        } 
    
?>
    </td>

    <td  class="djc_value">
    <?php 
        
if (is_array($this->item_cursor->$attributeName)){
            
$this->item_cursor->$attributeName implode(', '$this->item_cursor->$attributeName);
        }
        if (
$attribute->type == 'textarea' || $attribute->type == 'text'){
            
$value nl2br(htmlspecialchars($this->item_cursor->$attributeName));
            
// convert URLs
            
$value preg_replace('#([\w]+://)([^\s()<>]+)#iS''<a target="_blank" href="$1$2">$2</a>'$value);
            
// convert emails
            
$value preg_replace('#([\w.-]+(\+[\w.-]+)*@[\w.-]+)#i''<a target="_blank" href="mailto:$1">$1</a>'$value);
            echo 
$value;
        }

        else if (
$attribute->type == 'html') {
            echo 
JHTML::_('content.prepare'$this->item_cursor->$attributeName$this->params'com_djcatalog2.item.attributes');
        }
        else if (
$attribute->type == 'calendar') {
            echo 
JHtml::_('date'$this->item_cursor->$attributeNameJText::_('DATE_FORMAT_LC4'));
        } 
        else {
            echo 
htmlspecialchars($this->item_cursor->$attributeName);
        }    
    
?>
    </td>
</tr> 

 <?php ?>
 <?php ?>
 [/code]