Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Basic Question about Controller_Template
  • This might be very basic thing to ask but I have this problem.

    When using Controller_Template, and you want to exit from an action,
    I wrote the following. 

    $this->template->title = "LOGIN";
    $this->template->content = View::forge('users/login');
    return false;

    This gives me a blank white screen on my browser.
    How do I exit from an action and still render the template?

    Thanks for your help. 
  • HarroHarro
    Accepted Answer
    The Controller_Template doesn't use, nor expects, return values.

    So simply use "return;" (or if you insist on returning a value, "return null;".
  • Harro

    As usual you are a life saver.
    Simple "return" seems to be working.

    I tried return false, exit and die. All of them returned white screen.
  • HarroHarro
    Accepted Answer
    That is because the after() method of the controller does

    if ($response === null) ...

    to check if anything was returned.

    If so it will use that instead of the template, it allows you to return for example a View object and override the template system (for example for an error page that doesn't use the configured page template).

Howdy, Stranger!

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

In this Discussion