Basit bir PHP bir soru

0 Cevap php

Ben temelde kategorilerin listesini görüntüleyen bir Joomla modülü var. Sonraki kategori adına, söz konusu kategoride öğelerin sayısı aşağıdaki satırını kullanarak görüntülenir

 <em>(<?php echo $row->counter ;?>) </em>  

Kategorilerde öğeler, 'açık', 'yakın' ya da 'dondurulmuş' ve ben sadece 'açık' öğelerin sayısını gösterir ve herhangi bir yakın veya dondurulmuş öğeler içermez, böylece bunu yapmak için çalışıyorum ya ayarlanır.

<?php

// no direct access
defined('_JEXEC') or die('Restricted access'); 

$document =& JFactory::getDocument();
$html = '<link href="'.JURI::base(). 'modules/mod_glance_categories/css/style.css" rel="stylesheet" type="text/css" />';
$document->addCustomTag( $html );

$n = 0;
if(count($rows) > 0){

?>
<table width="100%" cellpadding="0" cellspacing="0">
<?php
foreach ( $rows as $row ) 
{
 $n++;
if($n ==1){?>
<tr>   
<?php 
}
if($n <= $columns){
?>
 <td align="left" valign="top" >
 <?php $link_proj_categ = JRoute::_('index.php?option=com_glance&task=categproj&id='.$row->id);?>
 <a href="<?php echo $link_proj_categ;?>" class="tpf_tcatnode">
 <strong><?php echo $row->categories; ?></strong>
 <em>(<?php echo $row->counter ;?>) </em>
 </a>
  </td>
 <?php 
 }
 if($n == $columns){?>
  </tr> 
  <?php 
 $n =0;
   }  
}
$n++;
if($n <= $columns){
 for($x=$n;$x<=$columns;$x++){?>
  <td>&nbsp;</td>
 <?php
}?> 
 </tr> 
 <?php 
 } ?>

  </table>
  <?php } ?>

0 Cevap