Jump to content


Photo

Limit siblings AFTER removing $page

siblings limit

  • Please log in to reply
3 replies to this topic

#1 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 799 posts
  • 207

  • LocationMidlands, UK

Posted 24 April 2012 - 12:37 PM

Am trying to list 3 other events (siblings) at the bottom of an event page.

My problem is I can only seem to limit before I remove the $page part meaning I end up with only 2 other events at the bottom of the page.

Have tried the following but doesn't seem to work:


$page->siblings->remove($page);
$events = $page->siblings("limit=3");

I've tried various things but perhaps someone more knowledgeable could point me in the right direction?

Thanks :)

#2 Soma

Soma

    Hero Member

  • Moderators
  • 3,188 posts
  • 1745

  • LocationSH, Switzerland

Posted 24 April 2012 - 12:46 PM

Direction:


$events = $page->siblings->remove($page)->find("limit=3");

@somartist | modules created | support me, flattr my work flattr.com


#3 onjegolders

onjegolders

    Hero Member

  • Members
  • PipPipPipPipPip
  • 799 posts
  • 207

  • LocationMidlands, UK

Posted 24 April 2012 - 01:06 PM

Find!
Thank you Mr Soma, you are a gentleman! :)

#4 ryan

ryan

    Hero Member

  • Administrators
  • 5,773 posts
  • 3115

  • LocationAtlanta, GA

Posted 25 April 2012 - 10:56 AM

You could also do this:

$events = $page->siblings->remove($page)->slice(0,3);

but this may be better:

$events = $page->siblings("id!=$page, limit=3");






Also tagged with one or more of these keywords: siblings, limit

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users