calinrada / PhalconUserPlugin

184 stars 68 forks source link

Blank pages #7

Closed Miguel-Herrero closed 10 years ago

Miguel-Herrero commented 10 years ago

I am trying to use this plugin in a new project. However, once "configured", blank pages appear and nothing is displayed.

1) Created blank project through DevTools (latest versions of everything) 2) Downloaded PhalconUserPlugin through Composer. 3) Configured services.php like in the Plugin README.md 4) Copied resources array (PUBLIC version) from README.md to config.php 5) Added path to PhalconUserPlugin to config:

'UserPlugin'     => __DIR__ . '/../../vendor/crada/phalcon-user-plugin/Phalcon/UserPlugin/'

6) registeredNamespaces for the Plugin:

$loader->registerNamespaces(
    array(
        'Phalcon\UserPlugin' => $config->application->UserPlugin
    )
)->register();

7) SQL Schema imported to DB (and configured in config.php) 8) Accessed to index: blank page appears.

Am I missing some steps? Could you help me in getting this working?

Thank you!

calinrada commented 10 years ago

@Miguel-Herrero this plugin does not include a CRUD area. So, it is kind of normal to see blank pages. You must create the views for the controllers and render the forms if needed. Copy https://github.com/calinrada/PhalconUserPlugin#example-controller controller and create a view for the login method. You should be able to see the generated content.

Miguel-Herrero commented 10 years ago

mmm I tried, but even with a single

echo 'Hello world';

inside a test method (obviously because the view for the login method didn't work), doesn't show anything.

When I add the EventsManager to the dispatcher, it all goes blank:

$dispatcher->setEventsManager($eventsManager);

If I comment that line, everything works perfectly.

calinrada commented 10 years ago

Then it should be about the redirect. Do you have the User controller with actions as defined in configuration ? Default:

        'redirect' => array(
            'success' => 'user/profile',
            'failure' => 'user/login'
        ),
Miguel-Herrero commented 10 years ago

Yes, I have those methods and their views, but blank pages appear, still.

If I write a wrong URL, no error message appears, though.

I don't understand this, as I started everything from scratch! :-(

Miguel-Herrero commented 10 years ago

Hi, again.

I decided to create a new project from scratch, and commit every step you can see what files and configs there are.

Here is the link to this example project (develop branch):

https://github.com/Miguel-Herrero/phalcon-userPlugin

Maybe this way it's easier for you to take a look and see if any config should be changed.

Thanks again!

calinrada commented 10 years ago

Hi @Miguel-Herrero . You forgot one important thing. You don't have routes. This is why your app is not working. You have to define routes. Check http://docs.phalconphp.com/en/latest/reference/routing.html and https://github.com/phalcon/mvc for code samples.

Miguel-Herrero commented 10 years ago

Added some general routing:

$router->add('/:controller/:action/:params', array(

(commit: https://github.com/Miguel-Herrero/phalcon-userPlugin/commit/81f83a20fecde391e3a3180e103ef988ea064a5f)

but still not showing anything. I'm starting to feel bad for my incompetence...

Miguel-Herrero commented 10 years ago

Like @tylersnowden pointed out, I missed adding the config service to the $di.

Problem solved.