Zend Framework

Response - named segments

Details

  • Type: New Feature New Feature
  • Status: Resolved Resolved
  • Priority: Minor 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

Activity

Hide
Shaun Rowe added a comment -

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.

Show
Shaun Rowe added a comment - 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.
Hide
Gavin added a comment -

I needed this years ago in order to properly prioritize segments for portal-like websites, where "view panes" were dynamically selected and organized based on user preferences and other input. Javascript, CSS, and the DOM sometimes requires careful organization of "parts".

Show
Gavin added a comment - I needed this years ago in order to properly prioritize segments for portal-like websites, where "view panes" were dynamically selected and organized based on user preferences and other input. Javascript, CSS, and the DOM sometimes requires careful organization of "parts".
Hide
Shaun Rowe added a comment -

I see these changes are in th svn trunk now. Good work guys. can't wait to start playing around with it.

Show
Shaun Rowe added a comment - I see these changes are in th svn trunk now. Good work guys. can't wait to start playing around with it.
Hide
Bill Karwin added a comment -

Assign Zend_Controller issues to Matthew.

Show
Bill Karwin added a comment - Assign Zend_Controller issues to Matthew.
Hide
Gavin added a comment -

I believe this issue is resolved and the committed patch works as asked for

Show
Gavin added a comment - I believe this issue is resolved and the committed patch works as asked for
Hide
Shaun Rowe added a comment -

I can confirm that

Show
Shaun Rowe added a comment - I can confirm that

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: