Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Routing always to the index controller [SOLVED]

I'm trying different things with Phalcon and I'm liking it but sometimes just get to my nerves...

I've created a brand new app, 3 controllers (index, login, users), 1 model (users). the app load correctly on the index controller using the views/index/index.volt template encapsulated in views/index.volt main layout template.

the views/index/index.volt contains this:

<h1>Dummy Test!</h1>

{{ link_to('login','Sign In') }} / {{ link_to('users/register','Sign up') }}

{# Inject the 'flash' service #}
<div id="messages">{{ flashSession.output() }}</div>

the views/index.volt contains this:

<h1>Dummy<small> - a Phalcon based test project</small></h1>
{{ content() }}

the links for Sign in and Sign up are correctly generated, however when I click on any of them it loads the same screen even though the URL in the address bar is correctly changed.

I've checked the php and apache error logs and couldn't find any errors. I've then added the debug in the bootstrap file with (new Phalcon\Debug)->listen(); and removed the try/catch statement. But still same result and no debug interface pops up.

any idea on how to troubleshoot this ?

thanks



1.4k
Accepted
answer

I've manage to solve the issue. I had two different problem here, one I've forgot that I've added the ACL security to the app but didn't finished to implement it so all modules are restricted and it return to the default controller/action pair which is index/index.

Second I didn't see any flash message because the injection in the bootstrap was wrong so I was setting the flash to use the sessions and after I was changing flash back to direct to change the css classes so this way the error wasn't showing up in the output as the volt template is using the session method.

Now I can see the flash message and I know I have to finish to implement the ACL to fix the routing/access issue.

It's really hard to troubleshoot when the error is of a logic nature and not syntax/configuration/etc.

thanks for reading. I'll mark the subject as Solved.