by
KK » Tue May 31, 2011 5:13 am
Hi,
Sorry I should have explained the changes I made last time.
You seem to have overwritten the modified files with the older ones.
This is what the problem was -
For each of the 6 images a post had, the original code was generating the ID for the containing DIV as follows (code in list_images.html)
- Code: Select all
<div id="photo_<cms:show k_count />" ...
So the IDs for the images went like 'photo_1', 'photo_2' etc.
The JavaScript code (in thumbgallery.js) then identified the images to be hidden/shown based on these IDs.
This worked for single pages (i.e. those that had images for a single item), however for list pages where multiple items were displayed, each with its own set of images, the IDs 'photo_1', 'photo_2' etc. got duplicated (each item's images were given these same IDs).
The fix was to give a unique set of IDs to each item's images. This can be easily done by adding the item's own page_id to each image. The modified code now became-
- Code: Select all
<div id="photo_<cms:show k_page_id />_<cms:show k_count />"
This will now generate IDs like 'photo_34_1', 'photo_34_2' for an item with page_id of '34' and 'photo_35_1', 'photo_35_2' for an item with page_id of '35'.
Finally the JavaScript code also needed to be modified to handle the changed IDs. I placed the modified code within a separate js file named 'thumbgallery_ex.js'.
The 'work.php' and 'work_list.html' that called the original js file was modified to additionally link in the new js file.
I have re-applied the changes.
Kindly take a backup of the modified files.