Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Set HMVC request into partial from main backend controller
  • Working with a controller in app/classes/controller/backend/index.php
    Why can't I call a module via HMVC request and set the returned view in a theme partial?

    class Controller_Backend_Index extends \Controller_Base_Backend
    {
        public function action_index()
        {
            $this->theme->set_partial('content', \Request::forge('blog/index', false) );
        }
    }
  • HarroHarro
    Accepted Answer
    That is not a problem, all our applications work that way.

    Assuming Controller_Blog::action_index() returns a View object, the problem might be that the result of a Request::forge() is an unexecuted Request object, and the Theme class can't deal with that.

    This will return a Response object, you can try that first but I'm not sure Theme likes that too:

    $this->theme->set_partial('content', \Request::forge('blog/index', false)->execute() );

    If this doesn't work, you need the Response value:

    $this->theme->set_partial('content', \Request::forge('blog/index', false)->execute()->response()->body() );

  • I had tried the first one previously, and nothing, the second however worked like a champ! Thank you very much.

Howdy, Stranger!

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

In this Discussion