Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple Random Images on same page
#1
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.
Reply
#2
use an array and randomize the array
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#3
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.
Reply
#4
(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?
Reply
#5
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
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#6
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
Reply
#7
This topic might have some useful info: http://get-simple.info/forums/showthread.php?tid=6973
Reply




Users browsing this thread: 1 Guest(s)