CodeIgniter Forums
unable to load view from different directory - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: unable to load view from different directory (/thread-43834.html)



unable to load view from different directory - El Forum - 07-25-2011

[eluser]tomas[/eluser]
I have a multiple application setup

Code:
application
    app1
    app2
    app3
common
    libraries
        Mylib.php
    models
    views
        myview.php

I want to share views between the applications. I added the 'common' package to the autoload.php, i.e.
Code:
$autoload['packages'] = array( COMMONPATH );
and I can already do this with libraries, i.e. I can do
Code:
$this->load->library('mylib');
that works just fine, but when I try to do
Code:
$this->load->view('myview');
I get "Unable to load the requested file". If I move myview.php to the view folder under the app in which I'm using it everything works just fine.

What's wrong? Is the autoloader not looking for views in the 'common' dir even if it is added as a package? Or am I missing something trivial?

Thanks

----- EDIT ----

OK after looking at the Loader.php class I see that multiple paths for views are not supported like for heplers, libraries, models etc. If CI went truly multiapp I would assume this would work but obviously that isn't the case for views.


unable to load view from different directory - El Forum - 07-25-2011

[eluser]InsiteFX[/eluser]
Look in the WIKI at HMVC

InsiteFX