Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Minimal Fuel Hello World App - (A tip of controllers)
  • -
    Since a fuel controller always have to return something (if I'm wrong please feel free to correct me) we can't do this. Old fashion:
    class Controller_Hello extends Controller {
       function action_index() {
          echo 'Hello, World!!'; // This throw error
       }
    }
    
    Fuel way:
    class Controller_Hello extends Controller {
       function action_index(){
          return 'Hello, World!!'; // This run ok
       }
    }
    
  • That is not entirely true. Controller actions need to return a response object. Returning nothing, or returning something else is deprecated, and support for that will be removed after v1.1. That is not really related to echoing something in your controller (which you shouldn't do, it's bad practice), you can do that as long as you return a response object.
  • Thank you for clarify this, wanWizard, I post this because I wont see in Documentation. Excellent work with FUEL.[Code tested with 1.1rc1] I post this because I wont see in Documentation. Excellent work with FUEL.

Howdy, Stranger!

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

In this Discussion