BannersController.php - my version of existing method
[code] 
public function adminIndexAction()
    {
        if (!$this->is_admin()) $this->_redirect("/admin/login");

        $this->view->status_list = array('1' => 'online', '0'=> 'offline');
        $this->view->data = Banners::getBanners();


        $this->view->messages = $this->_flashMessenger->getMessages();
    }

[/code]
 if i use  $this->view->data = $this->Banners->getBanners(); i am getting:
Fatal error: Call to a member function getBanners() on a non-object in
C:\wamp\www\dev\application\controllers\BannersController.php on line 30

This works just fine on $this->Populars->getPopulars

Existing method i got from Populars.php
[code]
 public function adminIndexAction()
    {
        if (!$this->is_admin()) $this->_redirect("/admin/login");

        $this->view->status_list = array('1' => 'online', '0'=> 'offline');
        $this->view->data = $this->Populars->getPopulars(false);
        $this->view->messages = $this->_flashMessenger->getMessages();
    }
[/code]

This is how i remake original method 

public function getBanners()
        {  $where = null;
            if ($online_only) $where = 'status = 1';

            $rowset = $this->db->fetchAll('select * from banners');
            if (is_null($rowset)) return array();
            $idx = 0;
            foreach ($rowset as $row){
                $ar_res[$idx]['Banners'] = $row;
                $idx++;
            }

            return $ar_res;
}

Original method was:

public function getPopulars($online_only = true)
        {
            $where = null;
            if ($online_only) $where = 'status = 1';

            $rowset = $this->fetchAll($where, $this->getOrder());
            if (is_null($rowset)) return array();
            $idx = 0;
            foreach ($rowset as $row){
                $ar_res[$idx]['Populars'] = $row->toArray();
                $idx++;
            }

            return $ar_res;
        }
On my local mashine:
When i am using original method, i am redirected to public area of site and
getting this:
Internal server error
Error
An error occurred, please try again later.

if i am using first method i rewrote, everything is working on local
machine, but not on the live site.


Vincent-20 wrote:
> 
> On 5/16/08, vladimirn <[EMAIL PROTECTED]> wrote:
>>
>>
>> I misstyped what php said :) actually PHP said that method does not
>> exist,
>>
>> and i know that method exist. But when i include file Banner.php which
>>
>> contain that method, and change in code from $this->Banner->update to
>> Banner::update() then works fine.
>>
>> Original file(which i remake to make banner part) works fine with
>>
>> $this->Popular->update()...
>> Also after changes i made, i moved completly folder structure from my
>> localhost back to web, changing only database data in config.php and
>>
>> everything working but banners :)
>>
>> I like zend framework and what ZF offer, but it is so confusing sometimes
>> :)
>> I am not using SVn cause i cant figure it out how to use it. I read on
>> svn
>> web site but still dont get it. And it was already on web site i got to
>> adjust.
>> Thank you very much for your reply :)
> 
> 
> 
> So what does get_class($this->Banner) say?
> 
> -- 
> Vincent
> 
> 

-- 
View this message in context: 
http://www.nabble.com/noob-problem---ZF-works-on-localhost-but-not-on-webserver-tp17272058p17277324.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to