Phalcon dosn't render view

Hello, after a new installation of an "old"(Phalcon 2.0.8) project Phalcon does not render views anymore. If i debug the application with XDebug i can see that the last step is to register the view-engines. The application doesn't throw errors or exceptions and if i execute a "die"-Command in the Controller it shows me correctly:

namespace X\Front\Controller;

use X\Front\Controller\AbstractViewController;

class IndexController extends AbstractFrontController
{
    public function indexAction()
    {
        echo '<pre>';
        var_dump('This is a test');
        echo '</pre>';
        die();
    }
}

The path's are set correctly and i enabled every messages:

error_reporting(-1);
ini_set('display_errors', 'On');

No errors, not in the browser-window or in the logs. What can be the problem?



64.2k

put this crap in the layout/view aswell

echo $this->handle()->getContent();
edited Jan '16

I use Twig and extends only by the layout and fill the blocks. Before i checked it in the git everything works fine. Now after check all nothing works... Here is the implementation in my Bootstrap:

        $this->di->set('view', function () use ($config) {
            require SYSTEM_PATH . DS . 'vendor' . DS . 'twig' . DS . 'twig' . DS . 'lib' . DS . 'Twig' . DS . 'Autoloader.php';

            $view = new View();
            $view->setViewsDir(SYSTEM_PATH_SRC_FRONT . DS . 'Resources' . DS . 'views');
            $view->registerEngines(
                [
                    '.html.twig' => function ($view, $di) {
                        \Twig_Autoloader::register();

                        $options = [
                            'cache' => IS_DEVELOPMENT ? false : realpath(SYSTEM_PATH_VAR_CACHE . DS . 'twig') . DS,
                        ];

                        $functions = [
                            new \Twig_SimpleFunction('path',
                                function ($routeName, array $routeParameters = []) use ($di) {
                                    $router = $di->get('router');
                                    /* @var $router Router */
                                    $routerParams = $router->getParams();

                                    $urlParams = array_merge([
                                        'for'      => $routeName,
                                        'language' => $routerParams['language']
                                    ], $routeParameters);

                                    return $di->get('url')->get($urlParams);
                                }),
                        ];

                        $twig = new View\Engine\Twig($view, $di, $options, $functions);

                        $twig->getTwig()->addFilter(new \Twig_SimpleFilter('trans',
                            function ($key, array $values = []) use ($di) {
                                return $di->get('translator')->query($key, $values);
                            }));
                        $twig->getTwig()->addExtension(new FilterDumpExtension($di));

                        foreach ($this->getTwigExtensions() as $extension) {
                            $twig->getTwig()->addExtension($extension);
                        }

                        return $twig;
                    }
                ]
            );

            return $view;
        });

This code already works for it. The templates are named like i registrered the engine: "index.html.twig". But now, how i'm said after the checkout, the application doesn't work anymore.

Ah, one more information: The "render"-Method of Phalcon Incubator's Twig Render Engine isn't executed. I tested it by add a "die('test');" into the line 1 of the method. https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Mvc/View/Engine/Twig.php#L147