0

大家好,我正在使用 joomla 2.5 作为网站

我创建了一个组件来在后端的数据库中插入产品,我想在前端展示这个产品

我在视图中有此链接以显示 type=1 的产品;

 <div class="col2"><a href="<?php echo $this->baseurl ?>/index.php/hardware/integrados">Productos</a></div>

在组件 controller.php 的前端我有这个

class HardwareController extends JController
    function integrados(){
            $model = &$this->getModel(JRequest::getCmd('view'));
            $view  = &$this->getView(JRequest::getCmd('view'), 'html');
        $view->setModel($model, true);
        $view->hardwareIntegrado();
    }

在我的模型中,我有

class HardwareModelHardwares extends JModelList 
     function getIntegrados(){
         $db=& JFactory::getDBO();
         $query= "SELECT *
            FROM ".$db->nameQuote('#__hardware')."
            WHERE ".$db->nameQuote('tipo')."=".$db->quote("1").";";
         $db->setQuery( $query);
         $restaurantes=$db->loadObjectList();
         JRequest::setVar('hard', $restaurantes);
         return $restaurantes;
    }

在我的 view.html.php 我有这个

public function hardwareIntegrado(){
    $this->assignRef('pagination', $this->get('pagination'));
    $this->assignRef('hardware', $this->get('integrados'));
    $this->assignRef('list', $this->get('list'));
    parent::display();
}

当我单击链接时,我收到此错误

500 - View not found [name, type, prefix]: hardware, html, hardwareView

任何想法!

4

2 回答 2

1

您应该将视图类更改为hardwareViewHardware

于 2013-01-16T09:13:33.350 回答
0

You are getting this error-

500 - View not found [name, type, prefix]: hardware, html, hardwareView

because it's looking for hardware view.In the link- index.php/hardware/integrados it seems you are passing view=hardware . Whereas everywhere you have defined it as hardwares like in folder name and class.Either change link or class and folder.

Hope this will help.

于 2013-01-19T07:19:33.877 回答