Details
-
Type:
New Feature
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 0.8.0
-
Fix Version/s: 0.9.0
-
Component/s: Zend_Controller
-
Labels:None
Description
I suggest considering the possibility of supporting named body segments in the Response object.
This would allow manipulation of specific physical segments in the response, such as prepending a doctype based on the results of an action, then inserting or appending an inline CSS <style> section, meta tags, etc. as needed by XHTML code generated based on dynamically selected templates, and styles needed based on the specific templates used for a particular request.
For example:
// insert a "header" segment before the "body" segment $response->insert('header', 'body', $view->render($header)); // insert a "doctype" segment at the beginning of the "response" $response->prepend('doctype', 'header', $doctype)); // append content to the "header" segment $response->appendBody('header', $view->render('metatags.tpl.php'));
There are many possible variations of inserting, removing, prepending, appending, and setting segments in this ordered sequence data structure. Hopefully this Jira issue will prove useful to collect feedback and ideas into a single location for easy reviewing.
An obvious alternative exists using getBody() and setBody(), where all management of "segments" is done in userland. However, the current implementation of getBody() does not provide access to the $_body array, and various inefficiencies arise as a result. Adding support for getting and setting $_body as an array yields another alternative.
Issue Links
| This issue is dependecy of: | ||||
| ZF-1023 | Response::prependBody() |
|
|
|
This is a very cool idea. I'm not too happy with my current header/footer solution and this sounds like a great improvement and something I could really make use of.
Gets my vote.