Random Image Showcase

Hey all,

I have been scouring around the forums to a solution… basically, Im using the random image find:

  $showcase = $pages->find('projects','journal')->children()->visible()->shuffle()->first();
  $showcaseimage = $showcase->images()->shuffle()->first();

But now my problem is the fact that I want to make a timed slideshow that refreshes the div without refreshing the page. I have tried .load but I have yet to have a solution…

I think maybe ajax is a solution but the other part of the problem is that with the “shuffle()” I cant find a way to not shuffle again to the same image?

Please help!



Yes, AJAX is the way to go here. If you don’t want to use the same image again, you can exclude the random image from the rest of the images collection using not().

how would I achieve this? :S

You could pass the filename to your javascript via a data attribute and then pass it to the PHP script as parameter of a GET request or as a POST request.