GetSimple Support Forum
Multiple Random Images on same page - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: General Questions and Problems (http://get-simple.info/forums/forumdisplay.php?fid=16)
+--- Thread: Multiple Random Images on same page (/showthread.php?tid=7555)



Multiple Random Images on same page - AndersonMM - 2015-09-19

I'm trying to put 3 different random images on the same page. In my template, I just put:
PHP Code:
<?php random_content('Square-Images'); ?>
<?php random_content
('Square-Images'); ?>
<?php random_content
('Square-Images'); ?>
But this causes occasional duplicate images. Is there a way to achieve this so there are 3 unique random images on the page every time?

Thank you.


RE: Multiple Random Images on same page - shawn_a - 2015-09-19

use an array and randomize the array


RE: Multiple Random Images on same page - Carlos - 2015-09-19

I suppose AndersonMM is using the Random Content plugin.
If so, function random_content displays the output but doesn't return it, therefore it should be patched, or create a new modified one.


RE: Multiple Random Images on same page - AndersonMM - 2015-09-19

(2015-09-19, 20:41:45)Carlos Wrote: I suppose AndersonMM is using the Random Content plugin.
If so, function random_content displays the output but doesn't return it, therefore it should be patched, or create a new modified one.

In this case, a randomized array using random_content  would not help me?


RE: Multiple Random Images on same page - shawn_a - 2015-09-20

You could use object buffering into an array and remove duplicates then randomize output.

Of course like I said
Getfiles() and array random is better


RE: Multiple Random Images on same page - AndersonMM - 2015-09-20

shawn_a would you possibly be able to provide me a bit more of a snippet/example to get me going with that? Thank you for the Saturday support Smile


RE: Multiple Random Images on same page - datiswous - 2015-09-21

This topic might have some useful info: http://get-simple.info/forums/showthread.php?tid=6973