Простите за глупость.
Вот метод который находится в контролере:
function showQuestions(){
global $app;
$db = & JFactory::getDbo();
$limit = JRequest::getVar('limit', $app->getCfg('list_limit'));
$limitstart = JRequest::getVar('limitstart', 0);
$db->setQuery("SELECT COUNT(*) FROM #__my_comp");
$total = $db->loadResult();
jimport('joomla.html.pagination');
$pageNav = new JPagination($total, $limitstart, $limit);
$query = 'SELECT a.id, a.name, a.question, a.answer, b.name AS cat FROM #__my_comp AS a LEFT JOIN #__question_cat AS b ON a.id_cat = b.id ';
$cat_id = JRequest::getVar('cat_id', '');
if ($cat_id!==''){
$query .= 'WHERE id_cat = '.$cat_id;
}
$db->setQuery($query, $limitstart, $limit);
$rows = $db->loadObjectList();
HTML_my_comp::listQuestions ($this->option, $rows, $pageNav);
}
Дальше у меня есть admin.my_comp.html.php файл, в котором находится метод - listQuestions, используемый в последней строке, метода который выше.
function listQuestions ($option, $rows, &$pageNav){?>
<form action = "index.php" method="post" name="adminForm" id="adminForm">
<table class="admintable" width=100%>
<thead>
<tr>
<th><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count($rows);?>);"/></th>
<th><?php echo JText::_('Author'); ?></th>
<th><?php echo JText::_('Question'); ?></th>
<th><?php echo JText::_('Answer'); ?></th>
<th><?php echo JText::_('Category'); ?></th>
</tr>
</thead>
<tbody>
<?php
jimport('joomla.filter.output');
for($i=0; $i<count($rows); $i++){
$row = $rows[$i]; ?>
<tr>
<td><?= JHTML::_('grid.id', $i, $row->id); ?></td>
<td><?= JHTML::_('link', 'index.php?option=com_my_comp&task=reply&cid[]='.$row->id, $row->name); ?></td>
<td><?= $row->question; ?></td>
<td><?= $row->answer; ?></td>
<td><?= $row->cat; ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td colspan="5">
<?php echo $pageNav->getListFooter(); ?>
</td>
</tr>
</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 }
В принципе это все...