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
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.
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
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