Reputation: 4478
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();
$partials->setPartialsDir('../apps/common/views/');
return $partials;
});
And in index.phtml
, the partial is called like this
$this->partials->partial("header");
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\booktickets.com\frontend\apps\modules\books\views\index.phtml
The partial header.phtml
is partial directory. Can anybody shed light on this??
Upvotes: 0
Views: 1469
Reputation: 4478
Finally I found the solution
I have to changed my code to -
$di->set('partials', function() {
$partials = new View();
$partials->setViewsDir('../apps/common/views'); // absolute path to views dir
$partials->setPartialsDir('./'); // relative path to partials dir within
return $partials;
});
I got an answer from offical phalcon forum. Here is the link
Upvotes: 0