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.

Problem with my common view service for my application

Hi All,

I have a problem rendering a partial from a common view service in my application. Basically I have a multi module application ( 2 Modules ). Modules :

  1. Frontend
  2. Admin I have successfully registered a common view service like this in my service.php file :
    * Registering a shared view component
    $di->set('commonv', function() {
        $view = new \Phalcon\Mvc\View();       
        return $view;
    }, true);

The problem I have is when I actually try to display the common view like this :

    // show the common footer
    $di = $this->di->getDefault();
    $commonv = $di->get("commonv");
    // then in my view I do the following

Then I get an error message like this, :

    View 'C:\localhost\my-app/app/common/views/C:\localhost\my-app/app/common/views/partials/footer' was not found in the views directory
    #0 [internal function]: Phalcon\Mvc\View->_engineRender(Array, 'C:\\localhost\\my...', false, false, false)
    #1 C:\localhost\my-app\app\frontend\controllers\LoginController.php(31): Phalcon\Mvc\View->partial('footer')
    #2 [internal function]: Psg\my-app\Frontend\Controllers\LoginController->indexAction()
    #3 [internal function]: Phalcon\Dispatcher->dispatch()
    #4 C:\localhost\my-app\public\index.php(55): Phalcon\Mvc\Application->handle()

I can tell the paths do not look right, any advice on how I can fix it?



Path to the partials directory must be relative to the Views directory:



Thanks @Phalcon! Will give it a try now


Awesome it works! thanks!