21305 Posts in 5736 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 428 Views |
-
retrieving just 3 items from a datalist

13 July 2012 at 5:35pm
I have a new client that nicely coincides with the release of SS3 so I am converting the existing site from SS2.4. At one point, I want to show just the first 3 images from a gallery, rather than all the images. I'm guessing that this is a simple extension of the normal datalist syntax but I can't find it. Can someone offer a solution?
return DisplayAnythingFile::get()->filter(array('GalleryID' => $this->ImageGalleryID))->sort(array('Sort'=>'ASC'));
For extra points, I have another site where I'd like to retrieve a random 3 images from a gallery. I'm happy to just have a random starting point and retrieve the next 2 consecutive images. Any ideas?
thanks
bruce -
Re: retrieving just 3 items from a datalist

13 July 2012 at 7:45pm
When all else fails, RTFM. Or in this case, the API docs for datalist. The API lists getRange but that immediately throws an 'deprecated' message that describes the new method - limit($length,$offset). That is the answer to both my questions.
cheers all
bruce
| 428 Views | ||
|
Page:
1
|
Go to Top |

