Issues

ZF-1024: Response - named segments

Issue Type: New Feature Created: 2007-03-08T13:53:21.000+0000 Last Updated: 2007-07-05T14:43:54.000+0000 Status: Resolved Fix version(s): - 0.9.0 (17/Mar/07)

Reporter: Gavin (gavin) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Controller

Related issues: - ZF-1023

Attachments:

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

For example:

<pre class="highlight">
// 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.

Comments

Posted by Shaun Rowe (shakie) on 2007-03-12T06:11:44.000+0000

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.

Posted by Gavin (gavin) on 2007-03-12T11:35:05.000+0000

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".

Posted by Shaun Rowe (shakie) on 2007-03-14T08:10:44.000+0000

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

Posted by Bill Karwin (bkarwin) on 2007-03-15T13:33:18.000+0000

Assign Zend_Controller issues to Matthew.

Posted by Gavin (gavin) on 2007-03-15T13:38:00.000+0000

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

Posted by Shaun Rowe (shakie) on 2007-03-15T13:43:01.000+0000

I can confirm that ;)

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts