Re: set_display_context_callback() and incorrect pagination

Bharat Mediratta <[email protected]> Sat, 9 Feb 2013 11:58:25 -0800
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_m7aTbcasFCHNQqqtfRA5hDHsp2XhNigrRGy4WSeWwS3w@mail.gmail.com>
You should have position - we return it in the display context.  I just
added support for limit and offset in siblings so now in thumbnav you can
do:

        $siblings = $theme->siblings(5, max($theme->position - 2, 0));

That returns 5 items, 2 on either side.



On Tue, Feb 5, 2013 at 8:07 PM, Mike Miller <[email protected]> wrote:

>
> On Feb 5, 2013 10:56 PM, "Bharat Mediratta" <[email protected]> wrote:
> >
> >
> > Ok, so we need a sliding window of siblings around a fixed point, but
> the siblings_callback is returning an iterator over all siblings.  So
> perhaps the way to solve this is to extend siblings_callback to handle a
> limit and an offset.  Then you can do:
> >
> >   $theme->siblings($something + 1, $position - $something)
> >
> > and that'll just iterate over the small set of siblings that you care
> about.  How does that sonud?  I can probably get that checked in pretty
> quickly if you think that'll work.
>
> Seems reasonable, but I don't have $position in the block (at least, I
> don't seem to). can we do something like $theme->siblings($item, -2, 4) to
> return everything from two items before to four items after?
>
> Given that I don't know $position, we also need to consider what happens
> if more left-siblings or right-siblings are requested than actually exist.
>
> Thanks,
> --Mike
>

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]