previous and next links

I have a page with images and when you click on a thumb a larger image
opens. When the larger image opens the previous thumbs are not on the page
so it makes it a little awkward to navigate to the next image because I have
to go back with my browser back button, and then from the thumb page I click
on the next image for the larger image, then again the back button, etc..,
etc..

Is there a standard bit of code I can use to create previous and next links
on the larger image page?

thanks
ten [ Di, 20 März 2007 11:05 ] [ ID #1663203 ]

Re: previous and next links

On 20 Mar, 10:05, "ten" <ten [at] .com> wrote:
> I have a page with images and when you click on a thumb a larger image
> opens. When the larger image opens the previous thumbs are not on the page
> so it makes it a little awkward to navigate to the next image because I have
> to go back with my browser back button, and then from the thumb page I click
> on the next image for the larger image, then again the back button, etc..,
> etc..
>
> Is there a standard bit of code I can use to create previous and next links
> on the larger image page?
>
> thanks

you could script with javascript/php.
<a href="large.php?pic=duck.jpg title="large duck">
<img src="small_duck.jpg" alt="small duck" />
</a>

large.php

<?php
$pic = basename( $_GET['pic']);
$description = 'Large image of ' . $pic;
$previous = ($_SERVER['HTTP_REFERER']!='')
?
$_SERVER['HTTP_REFERER']
:
'javascript:history(-1);';
?>
<html>
<head>
<title><?php echo $description; ?></title>
</head>
<body>
<a href="<?php echo $previous; ?>" title="<?php echo $description; ?
>">
<img src="/images/large/<?php echo $pic; ?>" />
</a>
</body></html>

however if you open the larger image in a new window (or tab if your
user prevents new windows) - which is obviously discouraged, you just
need to use the target attribute of the a tag.

please see the <a href="large_image.jpg" target="bigger">large image
of a duck</a> for more detail

note though, the target attribute is not allowed with xhtml IIRC.
shimmyshack [ Di, 20 März 2007 11:21 ] [ ID #1663204 ]

Re: previous and next links

ten schreef:
> I have a page with images and when you click on a thumb a larger image
> opens. When the larger image opens the previous thumbs are not on the page
> so it makes it a little awkward to navigate to the next image because I have
> to go back with my browser back button, and then from the thumb page I click
> on the next image for the larger image, then again the back button, etc..,
> etc..
>
> Is there a standard bit of code I can use to create previous and next links
> on the larger image page?
>
How bout storing the request_uri ? Presivous page is the previous
request uri :-)

$lastpage = $_SESSION['thispage'];
$_SESSION['thispage']=$_SERVER['REQUEST_URI'];

echo '<a href = "'.$lastpage.'">go back</a>';

As for the 'next page link' Im guessing you van create that from the
currentpage. I dont know you db setup

Arjen
http://www.hondenpage.com
Dave Williams [ Di, 20 März 2007 11:38 ] [ ID #1663205 ]

Re: previous and next links

ten wrote:
> I have a page with images and when you click on a thumb a larger image
> opens. When the larger image opens the previous thumbs are not on the page
> so it makes it a little awkward to navigate to the next image because I have
> to go back with my browser back button, and then from the thumb page I click
> on the next image for the larger image, then again the back button, etc..,
> etc..
>
> Is there a standard bit of code I can use to create previous and next links
> on the larger image page?
>
> thanks
>
>
Is the problem with the navigation design? Is there some reason why ALL
thumbnails, except the one for the displayed image, are not in the menu
list?

But to answer the question, with some provisos, if you wish to access
the cached previous pre-processed file place a javascript activated
"previous" link on the page

<form>
<input type="button" value="previous image" onclick="history.go(-1)">
</form>

Louise
boclair [ Mi, 21 März 2007 01:31 ] [ ID #1664358 ]
PHP » alt.php » previous and next links

Vorheriges Thema: Re: Why is my email looking screwed up in Outlook?
Nächstes Thema: reducing file size?