this is the code in my controller.php
Code: Select all
function showFishList()
{
global $option, $mainframe;
$limit = JRequest::getVar('limit', $mainframe->getCfg('list_limit'));
$limitstart = JRequest::getVar('limitstart', 0);
$db =& JFactory::getDBO();
$query = "SELECT count(*) FROM #__fish_description";
$db->setQuery( $query );
$total = $db->loadResult();
$query = "SELECT * FROM #__fish_description";
$db->setQuery( $query, $limitstart, $limit );
$db->setQuery( $query );
$rows = $db->loadObjectList();
if ($db->getErrorNum()) {
echo $db->stderr();
return false;
}
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
HTML_fishsearch::showFishList( $option, $rows, $pageNav );
}
Code: Select all
function showFishList( $option, &$rows, &$pageNav )
{
?>
<form action="index.php" method="post" name="adminForm">
<table class="adminlist">
<thead>
<tr>
<th width="20">
<input type="checkbox" name="toggle"
value="" onclick="checkAll(<?php echo
count( $rows ); ?>);" />
</th>
<th align="center" valign="middle"><img src="components/com_fishsearch/images/googlesearch.gif" alt="" width="18" height="18" title="Feeding" /></th>
<th>Scientific Name</th>
<th>Common Name</th>
<th>Discover By</th>
<th>GeoLocation</th>
<th>Ecosystem</th>
<th width="30">F</th>
<th width="30">D</th>
<th width="30">C</th>
<th width="30">S</th>
<th width="5%" nowrap="nowrap">Status</th>
</tr>
</thead>
<?php
jimport('joomla.filter.output');
$k = 0;
for ($i=0, $n=count( $rows ); $i < $n; $i++)
{
$row = &$rows[$i];
$checked = JHTML::_('grid.id', $i, $row->FishID );
$published = JHTML::_('grid.published', $row, $i );
$link = 'index.php?option=' . $option . '&task=edit&cid[]='. $row->FishID ;
?>
<tr class="<?php echo "row$k"; ?>">
<td>
<?php echo $checked; ?>
</td>
<td align="center" valign="middle">
<img src="components/com_fishsearch/images/googlesearch.gif" alt="" width="18" height="18" title="Search Scientific Name Google" /></td>
<td>
<a href="<?php echo $link; ?>"><?php echo $row->ScientificName; ?></a>
</td>
<td>
<?php echo $row->CommonName; ?>
</td>
<td>
<?php echo '('.$row->discoveredby.')'; ?>
</td>
<td>
<?php echo $row->GeoLocation; ?>
</td>
<td>
<?php echo $row->MainEcosystem; ?>
</td>
<td align="center"><img src="../../images/FishSearch/icons/icon-food<?php echo $row->FeedingID; ?>.gif" width="20" height="20" title="Feeding" /></td>
<td align="center"><img src="../../images/FishSearch/icons/icon-dif<?php echo $row->DifficultyID; ?>.gif" width="20" height="20" title="Difficulty"/></td>
<td align="center"><img src="../../images/FishSearch/icons/icon-comp<?php echo $row->CompatibilityID; ?>.gif" width="20" height="20" title="Compatibility"/></td>
<td align="center"><img src="../../images/FishSearch/icons/icon-strat<?php echo $row->StratumID; ?>.gif" width="20" height="20" title="Stratum"/></td>
<td align="center">
<?php echo $published;?>
</td>
</tr>
<?php
$k = 1 - $k;
}
?>
<tfoot>
<td colspan="12"><?php echo $pageNav->getListFooter(); ?></td>
</tfoot>
</table>
<input type="hidden" name="option" value="<?php echo $option;?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
</form>
<?php
}
thank you all