Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
New and Learning
  • So am new to FuelPHP and am liking it a lot, features such as the namespaces, lightweightness of the framework and so on. But am really struggling to learn, its taking a lot longer than usual. But anyways so am picking apart tutorials and generated code and everything and came across the Response class. I looked at the dev_docs and docs and couldn't find what I needed so went to the source code of the class and basically found the reforge method just responds with the given content. But in the Welcome class the code is as follows... return Response::forge(View::forge('home/index')); But I found that you can actually just use View::forge to return the content. So why in the Welcome class you use both classes and functions?
  • Returning nothing or string values (or anything that evaluates to string) was standard in v1.0, but is deprecated in v1.1. Because we don't remove deprecated functionality until the next release, you can currently still use the old method, as you have found out. If you have logging active, you will see deprecated warnings in your logs. In the next release (after v1.1) the code will be removed, and you will have to return a Response object. The current Response object does HTTP only, but towards the future it is likely that more response types will be supported.
  • So using View to return is deprecated? or do you mean Response::forge?
  • Returning anything but a Reponse object is deprecated. In previous versions, a string was exepected. Returning a view worked because it contains a __toString() magic method, which renders the view to a string when requested.
  • So I should do a Response::forge($content) $content being filled with whatever I want displaying?
  • With whatever response you want to return. Because it's not always about display, it could be an HMVC request that returns a response to the calling controller.

Howdy, Stranger!

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

In this Discussion