To use this website completely, it is necessary to store cookies on your computer.
 

* Navigator

Expand - Collapse

* Statistic

  • *Total Posts: 14942
  • *Total Topics: 2271
  • *Online Today: 10
  • *Most Online: 292
(2016 November 12, 09:37:31 am)

Aeva Media - Random Image PHP Code

Started by DirtRider, 2010 November 10, 05:25:10 am

previous topic - next topic

0 Members and 0 Guests are viewing this topic.

DirtRider

2010 November 10, 05:25:10 am
I have the following code to show random media images in a PHP block. However what I need is to be able to show only selected media galleries and not all.

Code Select
global $sourcedir;
loadLanguage('Aeva');
@include_once($sourcedir . '/Aeva-Subs.php');
echo preg_replace('~<div class="highslide-

maincontent">.*?</div>.*?</div>~', '', aeva_listItems

(aeva_getMediaItems(0, 5, 'RAND()'), false, '', 5));
"The real question is not whether machines think but whether men do. "


b4pjoe

#1
2010 November 10, 07:27:41 am
Change the number (10)) in the last line to whatever album number you want it to use. If you want to show more than one gallery change (10)) to something like (2,8)) to show random images from gallery 2 and 8. Change 16 to the number of images you want it to display.

Code Select
global $sourcedir;
loadLanguage('Aeva');
@include_once($sourcedir . '/Aeva-Subs.php');
echo preg_replace('~<div class="highslide-

maincontent">.*?</div>.*?</div>~', '', aeva_listItems

(aeva_getMediaItems(0, 16, 'RAND()', true, array(10)), true, 'center', 0));

DirtRider

#2
2010 November 10, 09:15:32 am
Wow thank you so much this is what I needed  O0  :) :)
"The real question is not whether machines think but whether men do. "


DirtRider

#3
2010 November 10, 08:09:37 pm
BTW Nao just gave me this code now for it as well said it is a better one to use  O0

Code Select
global $sourcedir;
loadLanguage('Aeva');
@include_once($sourcedir . '/Aeva-Subs.php');
echo aeva_listItems(aeva_getMediaItems(0, 16, 'RAND()', true, array(1)), true, 'center', 0);
"The real question is not whether machines think but whether men do. "


b4pjoe

#4
2010 November 11, 12:02:25 am
I would go with what Nao says. ;)