Hi Jan.
Thanks for your answer.
I have now tried PhocaGallery 2.6.2 on three fresh installations.
None of them can have random view of the actual images.
So, I checked the file for Parameters.
I find four places in config.xml to set Random.
Categories Image Ordering (default option=9)
Category Image Ordering (default option=9)
Category Image Ordering CV (default option=9)
Slideshow Random
Categories Image Ordering, Category Image Ordering and Category Image Ordering CV has no effect whatsoever to change the ordering of images.
The ONLY place that I can set image ordering, on a fresh joomla and a fresh PhocaGallery, is with General settings -> Image Ordering.
However, Image Ordering under the tab General Settings doesn't have the option Random.
So I checked what function is used for image ordering.
In the file ordering.php, there is a class PhocaGalleryOrdering and it has a function called getOrderingString.
There are 10 case's in this function.
case 9 is blank, it has no ordering.
Code: Select all
<?php
/*
* @package Joomla 1.5
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Gallery
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined( '_JEXEC' ) or die( 'Restricted access' );
class PhocaGalleryOrdering
{
/*
* Set Ordering String if Ordering is defined in Parameters
*/
function getOrderingString ($ordering) {
switch ((int)$ordering) {
case 2:
$orderingOutput = 'ordering DESC';
break;
case 3:
$orderingOutput = 'title ASC';
break;
case 4:
$orderingOutput = 'title DESC';
break;
case 5:
$orderingOutput = 'date ASC';
break;
case 6:
$orderingOutput = 'date DESC';
break;
case 7:
$orderingOutput = 'id ASC';
break;
case 8:
$orderingOutput = 'id DESC';
break;
// Random will be used e.g. ORDER BY RAND()
/* if ($imageOrdering == 9) {
$imageOrdering = ' ORDER BY RAND()';
} else {
$imageOrdering = ' ORDER BY '.PhocaGalleryOrdering::getOrderingString($image_ordering);
}
*/
case 9:
$orderingOutput = '';
break;
// Is not ordered by recursive function needs not to be used
case 10:
$orderingOutput = '';
break;
case 1:
default:
$orderingOutput = 'ordering ASC';
break;
}
return $orderingOutput;
}
}
?>
So even if I wanted to use Random, according to the code in ordering.php, I can't use random, simply because it doesn't exist. (It's actually commented out)
To make it even more odd, when I change case 9: to use ORDER BY RAND()
Code: Select all
case 9:
$orderingOutput = 'ORDER BY RAND()';
break;
it doesn't work. In fact, no images are displayed at all.
I tried using LIMIT 20 aswell, just to see, but still no images displays.
To make matters more confusing, the random does work in Phoca Gallery Module, and in the module, random is done like this:
Code: Select all
if ($image_ordering == 9) {
$imageOrdering = ' ORDER BY RAND()';
} else {
$imageOrdering = ' ORDER BY a.'.PhocaGalleryOrdering::getOrderingString($image_ordering);
}
and this is the way PhocaGallery used to order images before, atleast according to the commented code in ordering.php, line 48-53.
So it seems the module has a random that DOES work, and the component DOESN'T have a random at all.
Even if it should work as you say Jan, there is, as far as I can see no code for the use of Random...
Thanks
Amrit