noob problem - ZF works on localhost but not on webserver

View: New views
15 Messages — Rating Filter:   Alert me  

noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

First of all i would like to say hello to all in here  Tho, if i missed a topic, please move it onto the right place.

Well, i got to make some changes on the web site which has been make with zend framework. So i am kinda noob on ZF But job must have be done.

So i started to read tutorials and so on.. My task was to add some functionality on the existing web site.
I did it on my localhost, and everything is just fine. But, when i upload files to the web server, it wont work.
What could be possibly reason? Or reasons? Any ideas? Where to look into?
Thanks a lot in advance,
Vladimir

Re: noob problem - ZF works on localhost but not on webserver

by oetting :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi and welcome :)

You will have to supply more details about your problem for anyone to be able to help.

For instance what kind of error messages do you get?

Jacob Oettinger

vladimirn wrote:
First of all i would like to say hello to all in here  Tho, if i missed a topic, please move it onto the right place.

Well, i got to make some changes on the web site which has been make with zend framework. So i am kinda noob on ZF But job must have be done.

So i started to read tutorials and so on.. My task was to add some functionality on the existing web site.
I did it on my localhost, and everything is just fine. But, when i upload files to the web server, it wont work.
What could be possibly reason? Or reasons? Any ideas? Where to look into?
Thanks a lot in advance,
Vladimir

Re: noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Jacob, thank you :)
I will try to explain.
I have admin part of site. In administration i added new functionality- adding new banners.
I made a BannerController.php(controller), Banner.php(model), and following the example of guy who made whole application i made admin-index.phtml and admin-update.phtml in scripts/banner folder.
When you click on link i made in administration- Manage index banner, on my localhost i am getting a page with form for new banner. And it is working.

Also there is an index,phtml page where i am calling <?=$this->getActiveBanner()?> at some point. And this works fine too on my localhost.

But when i upload all on live site, clicking on Manage index banner not showing new form, but redirecting out of administration page, and display Error 500: Internal server error, please try again  ... or some. :)
If no ideas so far, i can post my methods, so you can take a look into it.
I am most confusing about that its work on localhost and same files doesn't work on live server :)

Second question is:
I used existing file which have very similar functionality. It displays data from other mysql table, but same methods are used. So i just copied existing files, and made a new one.
Eg. file Popular.php and PopularController.php i renamed to Banner.php and BannerController.php, and changed protected _name='popular' to _name='banners'.
Also changed some html code and when click on Manage index banner i was getting error: No cuch metod updateBanner. Code for that was: if($this->Banner->update()).. and then did: require_once('Banner.php'); if(Banner::update()) and then works :)
So i am so confused and dont have any clues about all this :)
Thank you one more time,
Vladimir


Hi and welcome :)

You will have to supply more details about your problem for anyone to be able to help.

For instance what kind of error messages do you get?

Jacob Oettinger

vladimirn wrote:
First of all i would like to say hello to all in here  Tho, if i missed a topic, please move it onto the right place.

Well, i got to make some changes on the web site which has been make with zend framework. So i am kinda noob on ZF But job must have be done.

So i started to read tutorials and so on.. My task was to add some functionality on the existing web site.
I did it on my localhost, and everything is just fine. But, when i upload files to the web server, it wont work.
What could be possibly reason? Or reasons? Any ideas? Where to look into?
Thanks a lot in advance,
Vladimir


Re: noob problem - ZF works on localhost but not on webserver

by Vincent T :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On 5/16/08, vladimirn <nezaboravi@...> wrote:

Hello Jacob, thank you :)
I will try to explain.
I have admin part of site. In administration i added new functionality-
adding new banners.
I made a BannerController.php(controller), Banner.php(model), and following
the example of guy who made whole application i made admin-index.phtml and
admin-update.phtml in scripts/banner folder.
When you click on link i made in administration- Manage index banner, on my
localhost i am getting a page with form for new banner. And it is working.

Also there is an index,phtml page where i am calling
<?=$this->getActiveBanner()?> at some point. And this works fine too on my
localhost.

But when i upload all on live site, clicking on Manage index banner not
showing new form, but redirecting out of administration page, and display
Error 500: Internal server error, please try again  ... or some. :)
If no ideas so far, i can post my methods, so you can take a look into it.
I am most confusing about that its work on localhost and same files doesn't
work on live server :)

Has it worked before on the live server? If not, are you sure the rewrite rules are correct?

Second question is:
I used existing file which have very similar functionality. It displays data
from other mysql table, but same methods are used. So i just copied existing
files, and made a new one.
Eg. file Popular.php and PopularController.php i renamed to Banner.php and
BannerController.php, and changed protected _name='popular' to
_name='banners'.
Also changed some html code and when click on Manage index banner i was
getting error: No cuch metod updateBanner. Code for that was:
if($this->Banner->update()).. and then did: require_once('Banner.php');
if(Banner::update()) and then works :)

Sorry, I can't follow this. Where are you calling updateBanner?

So i am so confused and dont have any clues about all this :)
Thank you one more time,
Vladimir




Cheers,

--
Vincent

Re: noob problem - ZF works on localhost but not on webserver

by oetting :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you are getting "500 Internal Server Error" there must be something wrong with the configuration of the server. It could be problems with a .htaccess file, but also all sorts of other problems. It is probably not directly related to ZF. You may be able to find more information in your servers error log.

It generally sounds like you could benefit from going through a introduction to ZF to help you better understand the interaction between the different parts of the MVC. You could look at:

http://akrabat.com/zend-framework-tutorial/ or
http://blog.astrumfutura.com/ (down at the moment)

Jacob Oettinger


Hello Jacob, thank you :)
I will try to explain.
I have admin part of site. In administration i added new functionality- adding new banners.
I made a BannerController.php(controller), Banner.php(model), and following the example of guy who made whole application i made admin-index.phtml and admin-update.phtml in scripts/banner folder.
When you click on link i made in administration- Manage index banner, on my localhost i am getting a page with form for new banner. And it is working.

Also there is an index,phtml page where i am calling <?=$this->getActiveBanner()?> at some point. And this works fine too on my localhost.

But when i upload all on live site, clicking on Manage index banner not showing new form, but redirecting out of administration page, and display Error 500: Internal server error, please try again  ... or some. :)
If no ideas so far, i can post my methods, so you can take a look into it.
I am most confusing about that its work on localhost and same files doesn't work on live server :)

Second question is:
I used existing file which have very similar functionality. It displays data from other mysql table, but same methods are used. So i just copied existing files, and made a new one.
Eg. file Popular.php and PopularController.php i renamed to Banner.php and BannerController.php, and changed protected _name='popular' to _name='banners'.
Also changed some html code and when click on Manage index banner i was getting error: No cuch metod updateBanner. Code for that was: if($this->Banner->update()).. and then did: require_once('Banner.php'); if(Banner::update()) and then works :)
So i am so confused and dont have any clues about all this :)
Thank you one more time,
Vladimir

oetting wrote:
Hi and welcome :)

You will have to supply more details about your problem for anyone to be able to help.

For instance what kind of error messages do you get?

Jacob Oettinger

vladimirn wrote:
First of all i would like to say hello to all in here  Tho, if i missed a topic, please move it onto the right place.

Well, i got to make some changes on the web site which has been make with zend framework. So i am kinda noob on ZF But job must have be done.

So i started to read tutorials and so on.. My task was to add some functionality on the existing web site.
I did it on my localhost, and everything is just fine. But, when i upload files to the web server, it wont work.
What could be possibly reason? Or reasons? Any ideas? Where to look into?
Thanks a lot in advance,
Vladimir

Re: noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Vincent :)
Web site is live and working on web server.
if($this->Banner->update()) is called in BannerController.php
(currently on webserver is: require_once('Banner.php'); if(Banner::update()))

.htaccess is identical on localhost and web server. I got it from web server when got this project. And it is working on my localhost.

also i noticed that when i am calling method like: $this->update('some sql statement') - which is in original file(popular.php - model) i remake for banners, i am getting error 500. If i use $this->db->update('some sql statement') it works fine.
Is there a possibility that problem is caused by version of FW? i am not sure what version i have on my computer. It could be ZF1.5, but not sure and dont know how to check. On web server i think that this is ZF 1.01.
Also, there is a folder inside every subfolder on web site which is called .svn. I dont know what is this for. :)
Sorry if i am bothering with my problem, just i dont know from where to start to solve it .

@Jacob- i already read acrabat and all tutorial from acrabat web site, but couldnt figure it out.. :(


Vincent-20 wrote:
On 5/16/08, vladimirn <nezaboravi@gmail.com> wrote:
>
>
> Hello Jacob, thank you :)
> I will try to explain.
> I have admin part of site. In administration i added new functionality-
> adding new banners.
> I made a BannerController.php(controller), Banner.php(model), and following
> the example of guy who made whole application i made admin-index.phtml and
> admin-update.phtml in scripts/banner folder.
> When you click on link i made in administration- Manage index banner, on my
> localhost i am getting a page with form for new banner. And it is working.
>
> Also there is an index,phtml page where i am calling
> <?=$this->getActiveBanner()?> at some point. And this works fine too on my
> localhost.
>
> But when i upload all on live site, clicking on Manage index banner not
> showing new form, but redirecting out of administration page, and display
> Error 500: Internal server error, please try again  ... or some. :)
> If no ideas so far, i can post my methods, so you can take a look into it.
> I am most confusing about that its work on localhost and same files doesn't
> work on live server :)


Has it worked before on the live server? If not, are you sure the rewrite
rules are correct?

Second question is:
> I used existing file which have very similar functionality. It displays
> data
> from other mysql table, but same methods are used. So i just copied
> existing
> files, and made a new one.
> Eg. file Popular.php and PopularController.php i renamed to Banner.php and
> BannerController.php, and changed protected _name='popular' to
> _name='banners'.
> Also changed some html code and when click on Manage index banner i was
> getting error: No cuch metod updateBanner. Code for that was:
> if($this->Banner->update()).. and then did: require_once('Banner.php');
> if(Banner::update()) and then works :)


Sorry, I can't follow this. Where are you calling updateBanner?

So i am so confused and dont have any clues about all this :)
> Thank you one more time,
> Vladimir
>
>
>
>
Cheers,

--
Vincent

Re: noob problem - ZF works on localhost but not on webserver

by Vincent T :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On 5/16/08, vladimirn <nezaboravi@...> wrote:

Hello Vincent :)
Web site is live and working on web server.
if($this->Banner->update()) is called in BannerController.php
(currently on webserver is: require_once('Banner.php');
if(Banner::update()))

But you said PHP said:

no such method updateBanner

updateBanner() is a different method than update().

.htaccess is identical on localhost and web server. I got it from web server
when got this project. And it is working on my localhost.

also i noticed that when i am calling method like: $this->update('some sql
statement') - which is in original file(popular.php - model) i remake for
banners, i am getting error 500. If i use $this->db->update('some sql
statement') it works fine.

Sorry, I don't use Zend_Db so I can't help you here...

Is there a possibility that problem is caused by version of FW? i am not
sure what version i have on my computer. It could be ZF1.5, but not sure and
dont know how to check. On web server i think that this is ZF 1.01.

Using different versions of ZF will very likely cause differences in behaviour, best to develop using the same version. The version can be checked by opening the file Zend/Version.php, the VERSION contant contains the version number.

Also, there is a folder inside every subfolder on web site which is called
.svn. I dont know what is this for. :)

The .svn folders are metadata for Subversion, a Version Control System. Apparently this website is managed using Subversion, so it's a little bit odd that you're not using it yourself.

Sorry if i am bothering with my problem, just i dont know from where to
start to solve it .

@Jacob- i already read acrabat and all tutorial from acrabat web site, but
couldnt figure it out.. :(




Vincent-20 wrote:
>
> On 5/16/08, vladimirn <nezaboravi@...> wrote:
>>
>>
>> Hello Jacob, thank you :)
>> I will try to explain.
>> I have admin part of site. In administration i added new functionality-
>> adding new banners.
>> I made a BannerController.php(controller), Banner.php(model), and
>> following
>> the example of guy who made whole application i made admin-index.phtml
>> and
>> admin-update.phtml in scripts/banner folder.
>> When you click on link i made in administration- Manage index banner, on
>> my
>> localhost i am getting a page with form for new banner. And it is
>> working.
>>
>> Also there is an index,phtml page where i am calling
>> <?=$this->getActiveBanner()?> at some point. And this works fine too on
>> my
>> localhost.
>>
>> But when i upload all on live site, clicking on Manage index banner not
>> showing new form, but redirecting out of administration page, and display
>> Error 500: Internal server error, please try again  ... or some. :)
>> If no ideas so far, i can post my methods, so you can take a look into
>> it.
>> I am most confusing about that its work on localhost and same files
>> doesn't
>> work on live server :)
>
>
> Has it worked before on the live server? If not, are you sure the rewrite
> rules are correct?
>
> Second question is:
>> I used existing file which have very similar functionality. It displays
>> data
>> from other mysql table, but same methods are used. So i just copied
>> existing
>> files, and made a new one.
>> Eg. file Popular.php and PopularController.php i renamed to Banner.php
>> and
>> BannerController.php, and changed protected _name='popular' to
>> _name='banners'.
>> Also changed some html code and when click on Manage index banner i was
>> getting error: No cuch metod updateBanner. Code for that was:
>> if($this->Banner->update()).. and then did: require_once('Banner.php');
>> if(Banner::update()) and then works :)
>
>
> Sorry, I can't follow this. Where are you calling updateBanner?
>
> So i am so confused and dont have any clues about all this :)
>> Thank you one more time,
>> Vladimir
>>
>>
>>
>>
> Cheers,
>
> --
> Vincent
>
>


--
View this message in context: http://www.nabble.com/noob-problem---ZF-works-on-localhost-but-not-on-webserver-tp17272058p17272949.html

Sent from the Zend Framework mailing list archive at Nabble.com.




--
Vincent

Re: noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 :)

Vincent-20 wrote:
On 5/16/08, vladimirn <nezaboravi@gmail.com> wrote:
>
>
> Hello Vincent :)
> Web site is live and working on web server.
> if($this->Banner->update()) is called in BannerController.php
> (currently on webserver is: require_once('Banner.php');
> if(Banner::update()))


But you said PHP said:

no such method updateBanner
>

updateBanner() is a different method than update().

.htaccess is identical on localhost and web server. I got it from web server
> when got this project. And it is working on my localhost.
>
> also i noticed that when i am calling method like: $this->update('some sql
> statement') - which is in original file(popular.php - model) i remake for
> banners, i am getting error 500. If i use $this->db->update('some sql
> statement') it works fine.


Sorry, I don't use Zend_Db so I can't help you here...

Is there a possibility that problem is caused by version of FW? i am not
> sure what version i have on my computer. It could be ZF1.5, but not sure
> and
> dont know how to check. On web server i think that this is ZF 1.01.


Using different versions of ZF will very likely cause differences in
behaviour, best to develop using the same version. The version can be
checked by opening the file Zend/Version.php, the VERSION contant contains
the version number.

Also, there is a folder inside every subfolder on web site which is called
> .svn. I dont know what is this for. :)


The .svn folders are metadata for Subversion, a Version Control System.
Apparently this website is managed using Subversion, so it's a little bit
odd that you're not using it yourself.

Sorry if i am bothering with my problem, just i dont know from where to
> start to solve it .
>
> @Jacob- i already read acrabat and all tutorial from acrabat web site, but
> couldnt figure it out.. :(
>
>
>
>
> Vincent-20 wrote:
> >
> > On 5/16/08, vladimirn <nezaboravi@gmail.com> wrote:
> >>
> >>
> >> Hello Jacob, thank you :)
> >> I will try to explain.
> >> I have admin part of site. In administration i added new functionality-
> >> adding new banners.
> >> I made a BannerController.php(controller), Banner.php(model), and
> >> following
> >> the example of guy who made whole application i made admin-index.phtml
> >> and
> >> admin-update.phtml in scripts/banner folder.
> >> When you click on link i made in administration- Manage index banner, on
> >> my
> >> localhost i am getting a page with form for new banner. And it is
> >> working.
> >>
> >> Also there is an index,phtml page where i am calling
> >> <?=$this->getActiveBanner()?> at some point. And this works fine too on
> >> my
> >> localhost.
> >>
> >> But when i upload all on live site, clicking on Manage index banner not
> >> showing new form, but redirecting out of administration page, and
> display
> >> Error 500: Internal server error, please try again  ... or some. :)
> >> If no ideas so far, i can post my methods, so you can take a look into
> >> it.
> >> I am most confusing about that its work on localhost and same files
> >> doesn't
> >> work on live server :)
> >
> >
> > Has it worked before on the live server? If not, are you sure the rewrite
> > rules are correct?
> >
> > Second question is:
> >> I used existing file which have very similar functionality. It displays
> >> data
> >> from other mysql table, but same methods are used. So i just copied
> >> existing
> >> files, and made a new one.
> >> Eg. file Popular.php and PopularController.php i renamed to Banner.php
> >> and
> >> BannerController.php, and changed protected _name='popular' to
> >> _name='banners'.
> >> Also changed some html code and when click on Manage index banner i was
> >> getting error: No cuch metod updateBanner. Code for that was:
> >> if($this->Banner->update()).. and then did: require_once('Banner.php');
> >> if(Banner::update()) and then works :)
> >
> >
> > Sorry, I can't follow this. Where are you calling updateBanner?
> >
> > So i am so confused and dont have any clues about all this :)
> >> Thank you one more time,
> >> Vladimir
> >>
> >>
> >>
> >>
> > Cheers,
> >
> > --
> > Vincent
> >
> >
>
>
> --
> View this message in context:
> http://www.nabble.com/noob-problem---ZF-works-on-localhost-but-not-on-webserver-tp17272058p17272949.html
>
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


--
Vincent

Re: noob problem - ZF works on localhost but not on webserver

by Vincent T :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On 5/16/08, vladimirn <nezaboravi@...> 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

Re: noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

curently i am not at this computer. I will reply in hour and half :)

Vincent-20 wrote:
On 5/16/08, vladimirn <nezaboravi@gmail.com> 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

Re: noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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 <nezaboravi@gmail.com> 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

Re: noob problem - ZF works on localhost but not on webserver

by Vincent T :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Fri, May 16, 2008 at 5:21 PM, vladimirn <nezaboravi@...> wrote:

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 

So $this->Banners is not an object. Perhaps in the PopularController's init() method $this->Populars is defined? You'll probably need to do something similar in the BannersController, i.e. $this->Banners = new Banners().
 

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.

Could you post your .htaccess?
 


Vincent-20 wrote:
>
> On 5/16/08, vladimirn <nezaboravi@...> 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.




--
Vincent

Re: noob problem - ZF works on localhost but not on webserver

by vladimirn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

this is what i tought :)
but BannersController and PopularController have same methods. This is init()
public function init()
    {
        parent::init();

        require_once 'Zend/Filter.php';

        // load filters
        require_once 'Zend/Filter/StripTags.php';
//        require_once 'Zend/Filter/HtmlEntities.php';
        require_once 'lib/Zend/Filter/StripSlashes.php';

        $this->filters = new Zend_Filter();
//        $this->filters->addFilter(new Zend_Filter_StripTags())
//                        ->addFilter(new Zend_Filter_HtmlEntities())
        $this->filters->addFilter(new Zend_Filter_StripSlashes());
    }
Vincent-20 wrote:
On Fri, May 16, 2008 at 5:21 PM, vladimirn <nezaboravi@gmail.com> wrote:

>
> 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
>

So $this->Banners is not an object. Perhaps in the PopularController's
init() method $this->Populars is defined? You'll probably need to do
something similar in the BannersController, i.e. $this->Banners = new
Banners().


>
> 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.
>

Could you post your .htaccess?


>
>
> Vincent-20 wrote:
> >
> > On 5/16/08, vladimirn <nezaboravi@gmail.com> 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.
>
>


--
Vincent

Re: noob problem - ZF works on localhost but not on webserver

by Vincent T :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Fri, May 16, 2008 at 6:08 PM, vladimirn <nezaboravi@...> wrote:

this is what i tought :)
but BannersController and PopularController have same methods. This is
init()
public function init()
   {
       parent::init();

       require_once 'Zend/Filter.php';