Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to pass data from Controller to ViewModel ?
  • Hi all, When using Fuel\Code\View::forge(), it's easy to pass data from the controller to the view. View::forge('chose/view', $data); But when using ViewModel, it is not possible. (it seems.) View::forge('chose/view', $method); I have a bunch of ViewModel::forge calls from within my Controller, and I would like to use the same data form in all of them.
    How can I do like the View class?
  • I just noticed the Viewmodel class isn't documented. You interface with a Viewmodel object the same way as with a view, using the set() method.
    $viewmodel = Viewmodel::forge('chose/view');
    
    $viewmodel->set('var', $value);
    

Howdy, Stranger!

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

In this Discussion