Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Passing array from top controller to module.
  • Hello, I have one simple question. I've got top controller and many modules, I need to pass some data from top controller (where request is being created and executed) to module controller.
    What's the best way for doing this?
    In request class I see only set_param method. This might not be the cleanest way of doing such thing because I'm not passing actual params but some variables created in runtime...
    I was thinking about extending Request class and just adding 'variables' field into it.
  • Assuming your module controllers are called using a second request (an "HMVC" call), there is no need to change things, passing data to requests is fully supported. You can pass data on to the child request as a parameter of execute() method (has to be an array with one or more named variables). You can fetch these in the module controller the same way you fetch other parameters passed to it (i.e. named params in the URI).

Howdy, Stranger!

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

In this Discussion