Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Views and Namespaces
  • Hi,

    There is another problem I recently came across.

    I have module (Module A), with some simple static class defined as a helper. For now, this class main purpose is to serve some bits of HTML code.

    As I don't want to repeat same task in other modules, they use this class static function call to scraps of HTML. Function is rather simple for now, it is returning content of view file, located in module A.

    Now, when I call this class in context of Module A, everything is fine, but When I call same class/method from context of other modules, View class can't locate proper view file, however method itself can be executed.

    Any ideas ?

    PS. I've solved my problem using set_global view method, however it's still a bit unclear for me what is the difference between set_global() and bind_global(). They both seems to work same way...
  • The official standpoint is that you should not call cross-module, as that creates a tight coupling between the modules, but you should use standard controllers for this purpose, and use HMVC requests to fetch this data. An HMVC request switches context, to the view files can be found.

    If you insist on calling cross module, you can (this is Fuel after all ;-), by prefixing the view with the module name:

    return \View::forge('A::view/file/name');

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion