Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Views in Modules
  • Hello there!

    Let's say have I have a module called Cat, and I want to access a view from it: modules/cat/views/dog.php, how can I do it?

    I've tried  \View::forge('dog');  in one of the controllers in Cat, but It didn't turn out good. I guess it was trying to access app/views/dog.php
  • HarroHarro
    Accepted Answer
    If you're in a module controller that was routed to, that should work just fine.
  • Did it wok out just fine, because I am having the same issue?
  • Loading a view is pretty simple:

    If the current request is for a module controller, the search order is:
    - module (the module the controller is in only!)
    - app
    - packages
    - core

    This means you can not (and should not) do direct class calls across modules, if you are routed to a controller in module A, and you call \B\Class::method() and in that method you load a view, it will look for it in module A, and not module B !

Howdy, Stranger!

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

In this Discussion