Php kodlama Sorunları

1 Cevap php

Selam herkes PHP ve Joomla yeni im ve ben Joomla bir bileşeni geliştirdik ama benim kod bana hataları veriyor. Ben sorunu çözmek için çalıştı ama bunu çözmek için bi'şey yapamaz var. Yani herkes bana koduyla sorunun ne önerebilirsiniz? Şimdiden teşekkürler.

İşte benim iki dosya vardır:

1 view.html.php

defined('_JEXEC') or die('=;)');

jimport('joomla.application.component.view');

class namnamViewlistrestaurant extends JView
{
    function display($tpl = null)
    {
        $item = 'item';
        RestUser::RestrictDirectAccess();
        //-- Custom css
        JHTML::stylesheet( 'style.css', 'components/com_namnam/assets/css/' );

        $cuisine=Lookups::getLookup('cuisine');
        $lists['cuisine'] = JHTML::_('select.genericlist', $cuisine, 'idcuisine[]', 'class="inputbox" size="7"', 'value', 'text', $item->idcuisine);

        $category=Lookups::getLookup('restcategory');
        $lists['category'] = JHTML::_('select.genericlist', $category, 'idcategory[]', 'class="inputbox" multiple="multiple" size="7"', 'value', 'text', $item->idcategory);

        $items  = & $this->get('Data');
        $pagination =& $this->get('Pagination');

        $lists = & $this->get('List');

        $this->assignRef('items', $items);
        $this->assignRef('pagination', $pagination);
        $this->assignRef('lists', $lists);
        parent::display($tpl);

    }//function

}//class

Ve 2. listrestaurant.php olduğunu

defined('_JEXEC') or die('=;)');

jimport('joomla.application.component.model');

class namnamModellistrestaurant extends JModel
{
    var $_data;
    var $_total = null;
    var $_pagination = null;

    function __construct()
    {
        parent::__construct();
        global $mainframe, $option;

        $limit      = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 'int' );
        $limitstart = $mainframe->getUserStateFromRequest( $option.'.limitstart', 'limitstart', 0, 'int' );
        $limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
        $this->setState('limit', $limit);
        $this->setState('limitstart', $limitstart);
    }

    function _buildQuery()
    {
        $where = array();
        $where[]=" idowner=".RestUser::getUserID()." ";
        if ($this->search)
        {
            $where[] = 'LOWER(name) LIKE \''. $this->search. '\'';
        }

        $where =( count($where) ) ? ' WHERE ' . implode( ' AND ', $where ) : '';
        $orderby = '';

        #_ECR_MAT_FILTER_MODEL1_

        if (($this->filter_order) && ($this->filter_order_Dir))
        {
            $orderby    = ' ORDER BY '. $this->filter_order .' '. $this->filter_order_Dir;
        }

        $this->_query = ' SELECT *'
        . ' FROM #__namnam_restaurants '
        . $where
        . $orderby
        ;

        return $this->_query;
    }


    function getData()
    {
        if (empty($this->_data))
        {
            $query = $this->_buildQuery();
            $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
        }
        return $this->_data;
    }

    function getList()
    {
        // table ordering
        $lists['order_Dir'] = $this->filter_order_Dir;
        $lists['order']     = $this->filter_order;

        // search filter
        $lists['search']= $this->search;

        return $lists;
    }

    function getTotal()
    {
        // Load the content if it doesn't already exist
        if (empty($this->_total))
        {
            $query = $this->_buildQuery();
            $this->_total = $this->_getListCount($query);
        }

        return $this->_total;
    }

    function getPagination()
    {
        // Load the content if it doesn't already exist
        if (empty($this->_pagination))
        {
            jimport('joomla.html.pagination');
            $this->_pagination = new JPagination($this->getTotal(), $this->getState('limitstart'), $this->getState('limit') );
        }

        return $this->_pagination;
    }




}//class

Ve hataları şunlardır:

Uyarı: mülkiyet elde etmek için çalışmak C olmayan nesne: \ wamp \ www \ namnam.com 26 hattı üzerinde bileşenlerin \ com_namnam \ Defa \ listrestaurant \ view.html.php \

Uyarı: mülkiyet elde etmek için çalışmak C olmayan nesne: \ wamp \ www \ namnam.com hat 29 üzerinde bileşenlerin \ com_namnam \ Defa \ listrestaurant \ view.html.php \

Notice: Undefined özellik: C namnamModellistrestaurant :: $ search: \ wamp \ www \ namnam.com bileşenler \ satırında \ com_namnam \ modeller \ listrestaurant.php 38

Notice: Undefined özellik: C namnamModellistrestaurant :: $ filter_order: \ wamp \ www \ namnam.com bileşenleri 48 hattı üzerinde \ com_namnam \ modeller \ listrestaurant.php \

Notice: Undefined özellik: C namnamModellistrestaurant :: $ search: \ wamp \ www \ namnam.com bileşenler \ satırında \ com_namnam \ modeller \ listrestaurant.php 38

Notice: Undefined özellik: C namnamModellistrestaurant :: $ filter_order: \ wamp \ www \ namnam.com bileşenleri 48 hattı üzerinde \ com_namnam \ modeller \ listrestaurant.php \

Notice: Undefined özellik: namnamModellistrestaurant :: $ filter_order_Dir C: \ wamp \ www \ namnam.com bileşenleri \ hattında 76 \ com_namnam \ modeller \ listrestaurant.php

Notice: Undefined özellik: C namnamModellistrestaurant :: $ filter_order: \ wamp \ www \ namnam.com bileşenleri hattında 77 \ com_namnam \ modeller \ listrestaurant.php \

Notice: Undefined özellik: C namnamModellistrestaurant :: $ search: \ wamp \ www \ namnam.com bileşenler \ satırında \ com_namnam \ modeller \ listrestaurant.php 80

1 Cevap

Ben hataları açıklayan oldukça kendinden söyleyebilirim. Sorunun tam olarak nedir?

In view.html.php Eğer değişken $item ve özelliklerini $item->idcuisine ve $item->idcategory ama aslında, $item erişmeye çalıştığınızda sadece bir dizedir

 $item = 'item';

ve dolayısıyla özelliklerine sahip olamaz.


listrestaurant.php sınıf bir özellik search veya filter_order sahip görünmüyor içinde. Sen sınıfta onları tanımlamak değil, ama üst sınıf JModel bilmiyorum.