We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Controller-View not working

Im following the beginner tutorial 1 at https://docs.phalcon.io/en/latest/reference/tutorial.html#designing-a-sign-up-form But when I go to view the signup form, it says "Object not found!". However the previous tutorial with the "Hello! sign up here" page is working fine for me. I wonder what have I missed?



5.7k

Yes, and I am sure that the structure of the files and folders are correct too...



5.7k

Update: I just now downloaded the full example code identical to the tutorial examples, and I got the same "Object not found!" error when I click the Signup link from the index page.

Could someone please tell me why this is happening? I have tried this on [email protected], and a LAMP setup on Ubuntu. I still get the object not found after I click the signup link.



98.9k
Accepted
answer

Check that your baseUri is properly configured according to your set up:

//Setup a base URI so that all generated URIs include the "tutorial" folder
$di->set('url', function(){
        $url = new \Phalcon\Mvc\Url();
        $url->setBaseUri('/tutorial/');
        return $url;
});

https://docs.phalcon.io/en/latest/reference/tutorial.html#bootstrap



5.7k
edited Aug '14

Thanks, well at the htdocs root I have the "tutorial" folder holding the "app" and "public" folders inside, and the baseUri was exactly '/tutorial/'.

EDIT: I just found a strange thing: both https://localhost/tutorial/signup and https://localhost/tutorial/index can be loaded correctly if I type that in to the address bar. But on the index page's signup link, it is linking to https://localhost/public/signup Why is that?

EDIT2: I thought the tutorial included the baseUri setup in the index.php, that was the piece that I was missing with the tutorial example code downloaded from github.