Issues

ZF-2800: Add placeholder methods to partialLoop

Description

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 {{

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

Comments

Scheduling for first mini-release following 1.5.0 GA release.

This issue should have been fixed for the 1.5 release.

Please categorize/fix as needed.

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

Updating project management info.

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

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


<?php $this->placeholder('content')->setIndent(20)->set($this->layout()->content); ?>
<?php echo $this->placeholder('content'); ?> 

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:


<?php foreach ($this->foo as $i):
    $this->placeholder('content')->append($i);
endforeach; ?>

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