Hi,
This is how the beginning of th image_gallery_page function looks like:
function image_gallery_page($type = NULL, $tid = 0) {
$galleries = taxonomy_get_tree(_image_gallery_get_vid(), $tid, -1, 1);
for ($i=0; $i < count($galleries); $i++) {
$galleries[$i]->count = taxonomy_term_count_nodes($galleries[$i]->tid, 'image');
$tree = taxonomy_get_tree(_image_gallery_get_vid(), $galleries[$i]->tid, -1);
As you can see _image_gallery_get_vid() is called before the for loop and also inside the loop. I believe it would be better to store _image_gallery_get_vid() result in a local variable and reuse it later inside the loop.
A fix could be like this:
function image_gallery_page($type = NULL, $tid = 0) {
$vid = _image_gallery_get_vid();
$galleries = taxonomy_get_tree($vid, $tid, -1, 1);
for ($i=0; $i < count($galleries); $i++) {
$galleries[$i]->count = taxonomy_term_count_nodes($galleries[$i]->tid, 'image');
$tree = taxonomy_get_tree($vid, $galleries[$i]->tid, -1);
Regards,
Bartek
Comments
Comment #1
sunCommitted attached patch. Next time, please provide a patch, please.