Luc,
Okay, this is how I've done it for Willinghams - I hope you'll be able to make it work for your site too
I don't know what your table is called so I'll use the term
dbs for the code here, simply replace the instances of dbs with the name of your table. BEFORE YOU START PLEASE, PLEASE MAKE A BACKUP OF ALL YOUR DATA AND TEMPLATES IMAGE FIELDS: If you haven't already done so, create the required number of image fields in your table and create an equal number of thumbnail image fields too.
Tip: To make it easy to manage these fields you might consider using the taxonomy (
Photo_xx) for the photo fields and (
Thumb_xx) for the thumbnails, where
xx is a number.
NEW DETAILED TEMPLATE: To display the images and thumbnails we'll use a detailed record. Create a new template called
record_dbs_detail.html and copy and paste the HTML from your current
record_dbs.html into this new template.
DETAILED LINK: To display the detailed page we need a link to the search results using the new
d=1 variable to denote the detailed page view and
p=1 to say "
display photo 1".
Edit your
record_dbs.html template and add a link as follows (this can be over an existing part of the record or as a new separate link, its up to you): Code:
<a href="
db.cgi?db=dbs;do=search_results;d=1;ID=<%ID%>;p=1">Click for details</a>
or alternatively:
Code:
<a href="db.cgi?db=dbs;do=search_results;d=1;ID=<%ID%>;p=1"><%Field_Name%></a> SEARCH RESULTS: Your search results need to be modified to display the detailed page when d=1. Replace your current results loop with the following in your
search_results.html template:
<%if d eq '1'%> <!-- view detailed record -->
<%loop results%>
<%include record_dbs_detail.html%>
<%endloop%>
<%else%> <!-- List results -->
<%include record_dbs.html%>
<%endif%>
RECORD TEMPLATE: This is now used to show the basic search results that link to the detailed pages. You might want to edit this template to show only a limited number of fields, along with the link to the detailed page. The format and layout is up to you.
DETAILED RECORD TEMPLATE: You now use this detailed record template to display all the record info and the main photo and associated thumbnails. To do this we use the p=x variable to denote the photo to display, and <%if Thumb_xx> to display the thumbnails.
Where you want the main photo to be displayed, use the following template code (adjust it to suit your image field names and layout preferences):
Code:
<%if p eq '1'%> <!---view photo 1 large-->
<img src="db.cgi?db=dbs;do=view_file;cn=Photo_xx;id=<%ID%>" border=1>
<%elsif p eq '2'%> <!---view photo 2 large-->
<img src="db.cgi?db=dbs;do=view_file;cn=Photo_xx;id=<%ID%>" border=1>
<%elsif p eq '3'%> <!---view photo 3 large-->
<img src="db.cgi?db=dbs;do=view_file;cn=Photo_xx;id=<%ID%>" border=1>
etc ... etc ...
<%else%>
<%endif%>
Use the following for the thumbnails (note how p=x changes to denote a different main photo to display!):
Code:
<%if Thumb_01%>
<a href="db.cgi?db=dbs;do=search_results;d=1;ID=<%ID%>;p=1">
<img src="db.cgi?db=dbs;do=view_file;cn=Thumb_01;id=<%ID%>" border=1>
</a>
<%endif%>
<%if Thumb_02%>
<a href="db.cgi?db=dbs;do=search_results;d=1;ID=<%ID%>;p=2">
<img src="db.cgi?db=dbs;do=view_file;cn=Thumb_02;id=<%ID%>" border=1>
</a>
<%endif%> etc ...
That pretty much covers the changes - the layout and format are all up to you.
I hope you manage to get it working (sorry, but its been a few years since I modified it) and if you have any major problems, please feel free to email me.
All the best
Shaun