vinstone t
New member
Hi, I want to add a second new row after all the cells in the first row are filled and then display some description in the new row before repeating the loop. This is what I currently have for the table and the row data:
<table width="100%" cellpadding="0" cellspacing="0" class="tpf_tablerow">
<thead>
<tr class="tpf_rowhead">
<td><?php echo JText::_('Name'); ?></td>
<td><?php echo JText::_('Cat'); ?></td>
<td><?php echo JText::_('ID'); ?></td
</tr>
</thead>
<!--<tfoot>
<tr>
<td colspan="6">
<?php //echo $pageNav->getListFooter(); ?>
</td>
</tr>
</tfoot>-->
<tbody>
<?php
$k = 0;
for ($i=0, $n=count($rows); $i < $n; $i++) {
$row = $rows[$i];
?>
<tr class="tpf_<?php echo "row$k"; ?>" valign="top">
<td>
<?php echo $i+1; ?>
</td>
<td>
<?php
$link_project = JRoute::_('index.php?option=products&task=detail&id='.$row->id);
?>
<?php echo $row->name;?></a>
</td>
<td>
<?php echo $row->cat?>
</td>
<td>
<?php echo $row->id;?>
</td>
</tr>
/* somewhere around here is where I want to display the description information in a new row ...something like
echo $row->description. I've tried different combinations but kept
getting errors. How do I do that? Thanks!!! */
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
====
The result that I want to achieve looks like this:
1 name category id
>>> description information 1 here
2 name category id
>>> description information for 2 here
etc.
<table width="100%" cellpadding="0" cellspacing="0" class="tpf_tablerow">
<thead>
<tr class="tpf_rowhead">
<td><?php echo JText::_('Name'); ?></td>
<td><?php echo JText::_('Cat'); ?></td>
<td><?php echo JText::_('ID'); ?></td
</tr>
</thead>
<!--<tfoot>
<tr>
<td colspan="6">
<?php //echo $pageNav->getListFooter(); ?>
</td>
</tr>
</tfoot>-->
<tbody>
<?php
$k = 0;
for ($i=0, $n=count($rows); $i < $n; $i++) {
$row = $rows[$i];
?>
<tr class="tpf_<?php echo "row$k"; ?>" valign="top">
<td>
<?php echo $i+1; ?>
</td>
<td>
<?php
$link_project = JRoute::_('index.php?option=products&task=detail&id='.$row->id);
?>
<?php echo $row->name;?></a>
</td>
<td>
<?php echo $row->cat?>
</td>
<td>
<?php echo $row->id;?>
</td>
</tr>
/* somewhere around here is where I want to display the description information in a new row ...something like
echo $row->description. I've tried different combinations but kept
getting errors. How do I do that? Thanks!!! */
<?php
$k = 1 - $k;
}
?>
</tbody>
</table>
====
The result that I want to achieve looks like this:
1 name category id
>>> description information 1 here
2 name category id
>>> description information for 2 here
etc.