Say I'm viewing an image on the attachment.php page.
I want to customise that template so that there is a 'next' button that takes me to the next attachment for that same post. And have a 'previous' button that does a similar thing. So it is basically cycling through the attachments for a given post. If I have 5 images in a post, this is like a mini gallery for the post.
I want to avoid just moving to the next attachment id number, because that might be an image from a different post.
So I guess at the top of attachment.php I need to query the database and get a list of all the ids of attachments from the current post.
Does this sound sensible and does anyone have any suggestions or tips on how to proceed?