fuelphp

Pass parameters to Presenters (fuelphp)


How does one pass a parameters to a Presenter? Reading the documentation there doesn't seem to be a way.

https://fuelphp.com/docs/general/presenters.html

Controller

    $points = Presenter::forge('points', 'viewmy');
    $points->set('id', 5);

Presenter class or view (I tried both):

var_dump($id);
var_dump($this->id);

Both var_dumps generate an undeclared variable error

This in the Presenter class also did not work: $id = $this->get('id');


Solution

  • I finally got to the bottom of this issue. I was using the setview function in my Presenter to change based on condition. This was meaning that any values that I had set were getting lost.

    Passing the view into the 4th parameter of forge and not setting it in the presenter fixed this issue.