Issues

ZF-2737: Zend_View_Helper_PartialLoop loop counter

Issue Type: Improvement Created: 2008-02-27T06:50:32.000+0000 Last Updated: 2010-06-15T09:36:36.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Oren Sol (stanzapub) Assignee: Jon Whitcraft (sidhighwind) Tags: - Zend_View

Related issues: Attachments:

Description

I think it will be nice to have a counter in PartialLoop, in order to perform certain operations.

For instance: 1. To create a zebra striped table 2. To present an ordered list not using "ol" tags.

Any toughts?

Comments

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

Scheduling for mini release following 1.5.0 final release

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

This issue should have been fixed for the 1.5 release.

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

Please categorize/fix as needed.

Posted by Ramon de la Fuente (fuentez) on 2008-04-14T07:57:53.000+0000

To add A simple partialCounter variable:

Added to Zend_View_Helper_Partial on line 75 below $view = $this->cloneView();

    if ( isset($this->partialCounter) ) {
        $view->partialCounter = $this->partialCounter;
    }

Added to Zend_View_Helper_Partialloop:

public $partialCounter = 0;

And Changed the foreach loop in Zend_View_Helper_Partialloop on line 68 to foreach ($model as $item) { $this->partialCounter++;

        $content .= $this->partial($name, $module, $item);
    }

Posted by Ramon de la Fuente (fuentez) on 2008-04-14T08:02:39.000+0000

To add A simple partialCounter variable:

Added to Zend_View_Helper_Partial on line 75 below $view = $this->cloneView();

<pre class="highlight">
        if ( isset($this->partialCounter) ) {
            $view->partialCounter = $this->partialCounter;
        }

Added to Zend_View_Helper_Partialloop:

<pre class="highlight">
        public $partialCounter = 0;

And Changed the foreach loop in Zend_View_Helper_Partialloop on line 68 to:

<pre class="highlight">
        public $partialCounter = 0;

        foreach ($model as $item) {
            $this->partialCounter++;

            $content .= $this->partial($name, $module, $item);
        }

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:53.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-22T09:48:27.000+0000

Updating project management info.

Posted by Bert Van Hauwaert (becoded) on 2008-06-07T12:58:10.000+0000

While adding the counter, it would be useful to add a total variable too. Then it will be possible to determine if it is the last index or not.

Posted by bullfrogblues (gerardroche) on 2008-10-11T17:37:33.000+0000

This should be a must for the release.

e.g. if you need/require zebra striped tables/lists you can't use this.

Posted by bullfrogblues (gerardroche) on 2008-10-11T17:48:22.000+0000

There could be a default class value

e.g. echo $this->loopClass (or equivalent $this->loopDefaultClass etc.) which would return "odd" or "even" depending on loop count as default.

In your list/table then instead of

you could have simply Don't know if this is too much to ask, but at least the loop count should be a must for the next release.

Posted by Jon Whitcraft (sidhighwind) on 2008-11-11T17:35:50.000+0000

This has been added in with r12577

Posted by Francois (frankyz) on 2008-11-11T22:50:31.000+0000

@Jon Whitcraft: the short way to say: thank you! :)

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:00.000+0000

Changing issues in preparation for the 1.7.0 release.

Posted by Paul Court (gargoyle) on 2010-06-15T09:36:34.000+0000

I have some issues with the way that this has been implemented, the partial class is being used to set parameters in the view that are created in the partialLoop extension of the class. I have a working copy of my own version of partialLoop that does not require changes to partial to make it work.

Bittarman has kindly offered to mentor me next week so that I can figure out how to get my proposed changes into the system for review.

Just wanted to make a note of my intentions incase anyone here already has some other ideas - and so I don't forget, or get lazy and not do it ;-)

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