can anyone explain if there is a way to limit the number of additional images shown?
My supplier provides up to 10 but I only want to display a maximum of 3? is there any way to only get it to display the first 3 found?
Thanks in advance.
Phil
can anyone explain if there is a way to limit the number of additional images shown?
My supplier provides up to 10 but I only want to display a maximum of 3? is there any way to only get it to display the first 3 found?
Thanks in advance.
Phil
Phil Rogers
A problem shared is a problem solved.
You could copy /includes/modules/additional_images.php into /includes/modules/YOUR_TEMPLATE/additional_images.php and edit the following section (from the 1.5.0 version):
I'd make it "prettier" but I can't remember how to 'style' colors and the color buttons aren't there right now!Code:// Check for additional matching images $file_extension = $products_image_extension; $products_image_match_array = array(); $files_found = 0; /* Add this */ if ($dir = @dir($products_image_directory)) { while ($file = $dir->read() && $files_found < 3) { /* Change this */ $files_found++; /* Add this */ if (!is_dir($products_image_directory . $file)) { if (substr($file, strrpos($file, '.')) == $file_extension) { if(preg_match('/\Q' . $products_image_base . '\E/i', $file) == 1) { if ($file != $products_image) { if ($products_image_base . str_replace($products_image_base, '', $file) == $file) { // echo 'I AM A MATCH ' . $file . '<br>'; $images_array[] = $file; } else { // echo 'I AM NOT A MATCH ' . $file . '<br>'; } } } } } } if (sizeof($images_array)) { sort($images_array); } $dir->close(); }
Hi, thanks for this but its not working for me. to be fair i'm not yet on 1.5.0 yet, however the code is identical. When I implement this suggestion no images are shown at all? did it work for you or have you done this from theory?
Phil Rogers
A problem shared is a problem solved.
You could do it with CSS.
Set in the admin, max add images per row of 3, and then fix in the CSS the max height for the additional images container to the height of the first row, so all the other images aren't visible. Of course they are loaded etc, but not viewable by the user.
I prefer not to hide stuff. search engines dont like that sort of thing.
your initial idea looks like it should work but maybe its not quite coded right?
Phil Rogers
A problem shared is a problem solved.
not sure if the array() part has the file names at that point?
if so could i implement something like this example:
$input = array("a", "b", "c", "d", "e");
$output = array_slice($input, 2); // returns "c", "d", and "e"
$output = array_slice($input, -2, 1); // returns "d"
$output = array_slice($input, 0, 3); // returns "a", "b", and "c"
Phil Rogers
A problem shared is a problem solved.
Your not hiding anything, its not a hidden div, its just a reduced sized div. The content is all there and accessible, and search engines only ignore (not penalise) hidden content if it is blantantly spamming, other wise the millions of sites with tabbed divs which use display:none would be ranked down.
Bookmarks