Hello. I've got my site up and running now (what do you think?) and have a little problem with php coding. Now, I don't know jack s**t about it but have manage to find out a little bit so far.
I have a screenshots page which has a few thuumbnails on it, and clicking on them opens up a new php page which displays the full picture. Now, I'm trying to add next and previous links above the image to move through the pics. The code I have at the moment to do this which obviously isn't working is:
As you can see, I'm a bit of a programming novice and the site is still very basic but I'd be appreciative of your help.PHP Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>FarCry Home :: Screenshots</title>
<link rel="stylesheet" type="text/css" href="farcry.css" />
</head>
<body>
<table width="760" align="center">
<tr>
<td>
<p align="center"><img src="images/logo-FarCry.jpg" alt="FarCry"></p>
<p align="center"><a href="index.html">Home</a> |
<a href="about.html">About FarCry</a> | Screenshots |
<a href="downloads.html">Downloads</a> |
<a href="modsmaps.html">Mods & Maps</a> |
<a href="forum.html">Forum</a> | <a href="comments.html">Comments</a></p>
<p><img src="images/bar.jpg" /></p>
<h1>Screenshots</h1>
<p><img src="images/bar.jpg" /></p>
<p align="center"><a href="screenshots.html">Back to thumbnails</a></p>
<p align="center">
<?php
if(file_exists($img_dir.$iPrev.".jpg")) {
print '<a href="$PHP_SELF?im=$iPrev">Previous</a>';
}
?>
<?php
if(file_exists($img_dir.$iPrev."jpg")) {
print '<a href="$PHP_SELF?im=$iNext">Next</a>';
}
?>
<?php
$iCurr = $_GET["im"];
$iPrev = $iCurr - 1;
$iNext = $iCurr + 1;
$img_dir = './images/';
?>
<?php
/* define IMG directory */
$img_dir = './screenshots/';
echo "<div><img src=\"".$img_dir.$_GET["im"].".jpg\" /></div>";
?>
</p>
</td>
</tr>
</table>
</body>
</html>
Thanks in advance.
:edit: What do you think of the way the forum integrates into the site? Does it look ok? How does it cope on other browsers?


LinkBack URL
About LinkBacks

Reply With Quote


