Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Gallery Navigation Help - Please

Status
Not open for further replies.

Kyote2007

Programmer
Mar 31, 2007
3
AU
Hi,

I have a client that requires thumbnails for a gallery. I have built a thumbnail viewer with back/page/next links - works great. The problem: They also want a back/next link under the main pic that the thumbnails call.

Currently, clicking on a thumbnail reloads the page and passes the picture ID in the URL, when the page loads, a query then retrievs the picture with the pased URL.

Has anyone got any ideas on how I can create the back/next links, my guess is that I need to somehow load the previous and next picture ID... I should also mention that the IDs are not always going to be in sequential order (not as easy as ID -/+ 1) Here is the link to the live site:


You wil notice the back/next links under the main picture in the bottom right hand corner. If anyone needs to see the coding let me know. Any help this would be greatly appreciated. Thanks in advance, Brad
 
Why don't you put the normal pix or pix links in an array and call them through JS? That's cleaner than reloading the page every time the browser asks for another picture.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Not NULL-terminated yet.
 
philhege, your suggestion has two big problems:

1. If you load all the pictures and then use JS, your load time gets big very quickly as number and size of the photos approaches infinity.

2. The second is JS dependency for content is a BAD IDEA(tm) for a number of reasons... Largest of which is that some mobile devices and anti-JS zealots don't have Java Enabled, and you lose them off the top as repeat visitors.



[plug=shameless]
[/plug]
 
urrently, clicking on a thumbnail reloads the page and passes the picture ID in the URL, when the page loads, a query then retrievs the picture with the pased URL.


Since you are passing the picture ID in the URL, I will suggest to put the next and the previous picture IDs in a hidden field.

<Cfoutput>
<input type="hidden" name="previousPic" value="#myQuery.previousPicID#">
<input type="hidden" name="nextPic" value="#myQuery.nextPicID#">
</cfoutput>

then on your back and next links:

<cfoutput>
<cfif IsDefined('myQuery.previousPicID')>
<a href="....?pictureID=#myQuery.previousPicID#">Previous</a>
</cfif>

<cfif IsDefined('myQuery.nextPicID')>
<a href="....?pictureID=#myQuery.nextPicID#">Next</a>
</cfif>
</cfoutput>


hope it helps...


 
Thank you all for your input. The JS answer is not an option for reasons jstreich pointed out (and more). Thank you FALCONSEYE for your input. I solved the problem by running 2 new queries (to retrieve previous and next id's). I forgot to mention in the original post that I have a sort order field. I simply queried the databse base on the current ID passed in the URL and returned 1 record greater than or less (based on sort order number) than the current ID. I then simply called these IDs in the previous and next links.

Thank you again for everyones input.

All the best,

Brad
 
So any sort of AJAX implementation is out of the question for you folks. I find that extremely limiting.
 
Interesting idea philhege. Frankly - too much work for what I was paid for this site. Also, we come accross the problem where users that have java turned off will basically render the site unusable (unless of course you program mutual exclusion links etc - again, far too much work). This may be a good idea for some - thanks for your feedback. A suggestion philhege - rather than taking the arrogant approuch (which I fell you have in your comment), it might be better to actually provide some useful information (links, resource websites, etc). Thanks again.
 
Sho 'nuff:




These are just a smidgen from


My path is more .NET-centric, so I won't post those links here ;^)

Sorry about the off-putting tone. I understand the need to code to the largest demographic, but I also feel that one should be able to use all the tools at one's disposal, Luddites be damned.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
Not NULL-terminated yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top