ZF-2800: Add placeholder methods to partialLoop

Issue Type: Improvement Created: 2008-03-04T06:40:05.000+0000 Last Updated: 2009-02-06T09:36:08.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Dimitri van Hees (s481797) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: Attachments:


As the great ZF feature partialLoop will be used mostly when it comes to lists etc, it should (in my opinion) also contain the placeholder methods setPrefix(), setSeparator(), setIndent() and setPostfix. This way you'll be able to use the partialLoop to loop through an array with those html tags added. For example, I have created a partial which shows a single instance of an item. If there is only 1 item, I don't want to place it in a list. If there are more items, I want to use partialLoop to create a list with prefix

  • , separator
  • and postfix


I am now forced to either write my own foreach loop, or to add a partialLoop file which contains nothing more than

partial('myPartial.phtml', $this); ?>. In both example I don't get the performance benefits partialLoop should give me.


Posted by Matthew Weier O'Phinney (matthew) on 2008-03-06T09:57:25.000+0000

Scheduling for first mini-release following 1.5.0 GA release.

Posted by Wil Sinclair (wil) on 2008-03-21T17:05:29.000+0000

This issue should have been fixed for the 1.5 release.

Posted by Wil Sinclair (wil) on 2008-03-25T20:33:29.000+0000

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:49.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Ralph Schindler (ralph) on 2008-04-22T10:28:46.000+0000

Updating project management info.

Posted by Jason Eisenmenger (jasoneisen) on 2008-09-10T13:46:20.000+0000

In my opinion, every single view helper could use the setIndent() method. I could much use this on actions, placeholders, forms, etc...

Posted by Jason Eisenmenger (jasoneisen) on 2008-09-10T13:51:16.000+0000

As an example, I am currently doing this in one projects layout file to get the content to indent properly:

<pre class="highlight">
<?php $this->placeholder('content')->setIndent(20)->set($this->layout()->content); ?>
<?php echo $this->placeholder('content'); ?> 

Posted by Matthew Weier O'Phinney (matthew) on 2009-02-06T09:35:33.000+0000

This sounds like a mismatch between your expectations of the components and their intended purpose. If you want to use prefix/postfix/separator, simply loop over a variable and append the content to a placeholder:

<pre class="highlight">
<?php foreach ($this->foo as $i):
endforeach; ?>

If you want a common indentation method for helpers, please open a separate request.

Have you found an issue?

See the Overview section for more details.


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

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