Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba

Random order DataObject front end


Go to End
Reply


11 Posts   5826 Views

Avatar
pinkp

Community Member, 168 Posts

14 May 2011 at 10:57am

many thanks!!!!!! worked like a charm, although it had a syntax error at first the function needed to be:

function RandomSlideshowItems() { 
   return DataObject::get("SlideshowItem", "", "RAND()", ""); 
} 

I guess I should do a few more basics! thanks for the rapid response.

-----

On another note is it possible to limit the amount of data objects that are pulled from the DB, i.e. I upload 10 images but only 5 random images are chosen to be shown in the slideshow?

Avatar
UncleCheese

Forum Moderator, 4096 Posts

15 May 2011 at 4:00am

The fifth argument is the limit.

Avatar
pinkp

Community Member, 168 Posts

16 May 2011 at 12:31am

Changing the code to this allowed me to display a limited number of images sourced from my uploads and chosen at random. The result is a slideshow which will always have varied content, perfect!

 function RandomSliders($num = 3) { 
   return DataObject::get("Slider", "", "RAND()", "",$num); 
} 

Go to Top