您好我沒在的Joomla 2.5後端組件,但我有問題執行SQL查詢,我的變量是空的,所以它鴕鳥政策告訴我什麼。中的Joomla執行sql查詢
我有其他文件和文件,但這裏對我的問題很重要。
先在我Controller.php這樣我有這個內部管理文件
class BusquedaController extends JController
{
protected $default_view= 'restaurantes';
public function display(){
parent::display();
}
}
在我的模型文件我有restaurante.php
class BusquedaModelRestaurante extends JModelList{
function getListaRestaurantes(){
$db= JFactory::getDBO();
$sql= "SELECT * FROM #__restaurantes";
$db->setQuery($sql);
return $db->loadObjectList();
}
}
在我的控制器文件我有這個
class BusquedaControllerRestaurantes extends JControllerAdmin
{
public function getModel($name = 'Restaurante', $prefix = 'BusquedaModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
function listado(){
$firephp->log('hola');
$view=& $this->getView('restaurantes', 'html');
$model= $this->getModel("restaurante");
$listaMensajes= $model->getListaRestaurantes();
$view->assignRef('resList', $listaMensajes);
$view->display();
}
}
終於在我查看文件我有我如default.php,顯示錶中的TMPL文件
foreach ($this->resList as $item):
$checked=JHTML::_('grid.id', $n, $item->id); ?>
<tr>
<td><?php echo $checked; ?></td>
<td><?php echo $item->id; ?></td>
<td><?php echo $item->nombre; ?></td>
<td><?php echo $item->direccion; ?></td>
<td><?php echo $item->telefono; ?></td>
<td><?php echo $item->web; ?></td>
<td><?php echo $item->tipo; ?></td>
<td><?php echo $item->zona; ?></td>
<td><?php echo $item->metro; ?></td>
</tr>
<?php
,但該元素reslist是空的,我不知道如果我做我的組件嘛!!有人知道一個教程或東西的Joomla 2.5
感謝做一個組成部分!