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

TutorialController against SignupController

Hello,

I am trying to make singup form from Tutorial1: https://docs.phalcon.io/en/latest/reference/tutorial.html

My 'app/views/index/index.phtml' is:

<?php

echo "<h1>Hello!</h1>";

echo $this->tag->linkTo("signup", "Sign Up Here!");

Generated HTML is:

<h1>Hello!</h1><a href="/tutorial/signup">Sign Up Here!</a>

When I click "Sign Up Here" URL I get:

Exception: TutorialController handler class cannot be loaded

Why it tries to execute TutorialController when it should be SignupController?

Perhaps you missed this part from the tutorial in your bootstrap file:

$di->set('url', function () {
    $url = new UrlProvider();
    $url->setBaseUri('/tutorial/'); // This is the important part
    return $url;
});

Without it the router is using the default behaviour, thus thinking that Tutorial is the controller and Signup is the action.

edited Jul '16

I've double checked my bootstrap file. It contains this section and '/tutorial/' as the base URL.

I've tried to rename SignupController to TutorialController. Phalcon asked something about 'signup action'. Why it is thinking that Tutorial is the controller?

I cloned Phalcon from repository and built it manually from source.

Please, anybody help!

Unfortunately it is showstopping problem for me... What else should I do to understand where the problem is?



2.0k
Accepted
answer

Got it!...

VirtualHost pointed to subdirectory 'tutorial/public' ))

Fixed!

Glad you solved it by yoruself mate. Good job :)

Now mark your answer as accepted to solve the thread.