Proposal of improvements in mod_phocagallery_random_image?
Posted: 26 Jan 2009, 14:53
Hi,
I thing I've found a typo in line 347 of mod_phocagallery_random_image.php it looks like follows:
Shouldn't it be:
as there is no $image use in following lines, only $images value check?
Before the following line (building of the query) there is no check if $implodeAllowedCategoriesArray isn't an empty string (rare but possible), which in my case leads to "500 - JDatabaseMySQL::query: 1064 - You have an error in your SQL syntax; ...".
I've found also an interesting post concerning the speed of ORDER BY RAND() in big tables which could be important with some biiiig galeries and I think it may help sometimes with the query described above. The first example is broken (not proper html), so you must look at the source of the page.
EDIT:
I've tested it and it's good for LIMIT 1, not for more, and the lover ID's have bigger chance to be caught when some record was deleted or unpublished. Interesting proposition anyway.
And one thing more. I've changed last lines of the file from:
into:
so now whole module disappears when it has nothing to show.
I thing I've found a typo in line 347 of mod_phocagallery_random_image.php it looks like follows:
Code: Select all
$image = '';
Code: Select all
$images = '';
Before the following line (building of the query) there is no check if $implodeAllowedCategoriesArray isn't an empty string (rare but possible), which in my case leads to "500 - JDatabaseMySQL::query: 1064 - You have an error in your SQL syntax; ...".
I've found also an interesting post concerning the speed of ORDER BY RAND() in big tables which could be important with some biiiig galeries and I think it may help sometimes with the query described above. The first example is broken (not proper html), so you must look at the source of the page.
EDIT:
I've tested it and it's good for LIMIT 1, not for more, and the lover ID's have bigger chance to be caught when some record was deleted or unpublished. Interesting proposition anyway.
And one thing more. I've changed last lines of the file from:
Code: Select all
} else {
$i = 0;
$output[$i] = ''; // there is no image to get it as random image
}
require(JModuleHelper::getLayoutPath('mod_phocagallery_random_image'));
?>
Code: Select all
require(JModuleHelper::getLayoutPath('mod_phocagallery_random_image'));
}
?>