I'm developing an application with FuelPHP and I have the problem that I will try to explain below.
I developed a package that contains several controllers.
These controllers are used (via inheritance) in controllers that are contained in the "app/classes/controller" folder of my application.
The controllers in the package use views that are defined in the package folder ("packages/mypackage/views").
In one of the controllers of the app folder I need to override the default view set in the base class with a view that reside in the folder "app/classes/view".
But when I try to use the view in the app folder I receive the following error:
The requested view could not be found: viewname
COREPATH/classes/view.php @ line 388
I think that the framework searches the view in the package folder.
So the question is: when I build a view, how can explicitly refer a view that is contained in the app folder, even if a controller is placed in a package?
If you haven't customized the finder's path other, the order of search is modules, app, packages, core.
So if you have app/views/someview.php and app/packages/somepackage/views/someview.php, the one in app will be found before the one in the package.
The reason for this is that modules are app extensions, and packages are core extensions. They are not designed to contain frontend stuff like controllers and views.
You can explicitly load from a specific location (a module or a package) by using the namespace. So assuming in the example above the namespace of your package is "somepackage", you can load that using "somepackage::someview" as the viewname.
This will only work for known namespaces, so the package must be loaded for it to work.
That doesn't really control loading a view file...
From what I understand, the TS does:
// app controller class Controller_Something extends \Some\Other\Controller { ... }
// package controller namespace Some\Other; use View; class Controller extends \Controller { public function action_index() { // this should load from ./app/views, but doesn't return View::forge('someview'); } }