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.

"Partial not found in any of the views directory" exception

I have recently upgraded phalcon from 2.0.10 to 3.1.2 and PHP to version 7. Everything worked well before but seems its now broken after the upgrade

In index.php, i have set the partial directory like this-

$di->set('partials', function() {
                $partials = new View();
                return $partials;

And in index.phtml, the partial is called like this


header.phtml exist in ../apps/common/views directory.

When I run the site, it gives following error.

Fatal error: Uncaught Phalcon\Mvc\View\Exception: View '../apps/common/views/header' was not found in any of the views directory in D:\server\www\\frontend\apps\modules\books\views\index.phtml

The partial header.phtml is in partial directory. Can anybody shed light on this??


afaik, setPartialsDir must be a relative path, and a View instance must also have it's viewsDir set (the absolute part).

$partials = new View();
$partials->setViewsDir('../apps/common/views'); // absolute path to views dir
$partials->setPartialsDir('./'); // relative path to partials dir within
return $partials;