Page 1 of 1

Shuffle

Posted: Tue Oct 09, 2012 1:43 pm
by winyard
Hi, is it possible to make the images appear in a random order? to have them on a shuffle setting?

Re: Shuffle

Posted: Thu Oct 11, 2012 5:35 pm
by Vasiljevski
Hmm, not without some changes in the code.

This could be done by small change in template code. For example, if you use classic template, you could take the image array before it is output and shuffle:

plugins\content\admirorgallery\AdmirorGallery\templates\classic\index.php

Code: Select all

	  shuffle($AG->images);
	  // Loops over the array of images inside target gallery folder, adding wrapper with SPAN tag and write Popup thumbs inside this wrapper
	  if(!empty($AG->images)){	
	       foreach ($AG->images as $imageKey => $imageName){
		    $html.= '<span class="ag_thumb'.$AG->params['template'].'">';
		    $html.= $AG->writePopupThumb($imageName);
		    $html.='</span>';
	       }
	  }
I was surprised to see that PHP actually have a shuffle function :)