3460 Posts in 1064 Topics by 739 members
|Go to End|
21 November 2010 at 10:06am Last edited: 21 November 2010 10:18am
Ok, I am working on a basic gallery.
I have a galleryholder, gallerypage, and the gallerypage has many ImageResources
when in the gallerypage.ss how can I control through the ImageResources but have groups of 5 ImageResources returned until all are returned? Or until a set number are returned?
I need to wrap every 5 in a div tag for use in a scroller.
the post here: http://www.silverstripe.org/data-model-questions/show/4871
explains my issue very well except for he had control over the number of segments. I may need two divs or 10.
So having a method for each isn't working (a have done this for a latestgalleries feature, since I know I have a minimum amount of data I am just calling the last 10 galleries).
I have found information on pagination thats going in the right direction, but I haven't been able to make the jump to getting a version to work for my purposes.
21 November 2010 at 12:33pm
Ok the approach I think I would like to take is:
1: create a method (getGalleryGroupData) that can get my dataobjects (DataObject::get) and then setup and array to be returned as a dataobject so that I can loop through it in a control in the template. The array should contain 1 set of data for every group (the number of items it the group should be set by passed int) the data will simply be the limit points for querying this data.
2: a second method (getGalleryGroup) that takes two parameters and queries the for a dataobjectset and returns it.
so I should be able to use it like such in the template:
<% control GalleryGroupData %>
<% control GalleryGroup(startpoint,endpoint) %>
<% end_control %>
<% end_control %>
So I have the second method working already... I am lost in how I can gather the necessary information from the first dataobjectset and return it so that I can control through it.
23 November 2010 at 6:29am
OK, played around and now know that I can't pass parameters from a template as variables.
I have a solution, will try to clean it up and get it posted.
|Go to Top|