The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
eg
index.php?img=0
I want img to go from 0 - 10. Any way to do this?
EDIT: Works a treat.
Now to add a file count that will determine the maximum number of images. Don't tell me though, I'm learning :P
> Nimco wrote:
> Or use an if statement to display the previous and next buttons in
> the
> first place - like I do on my galleries.
>
> I was going to do something like this however my script already uses
> php in the link.
>
> > border="0">
>
>
> Would it be possible to do php including php. IE.
>
> >
> if(etc)
>
> echo (' above code ');
>
> ?>
Yup, nothing wrong with that at all - that's what PHP is for!
> At the minute I have an image with previous and next commands.
>
> This all works very well, however the problem I'm having is that
> images -1 and 5 don't exist.
>
> Pressing next will add 1 to "img" and pressing previous
> will deduct 1 from "img".
>
> Obviously, I don't want it to display pics that don't exist.
So on variable pickup do a check?
if ($var < 0) $var = 0;
if ($var > 10) $var = 10;
Dunno what you mean by image 5.
Ahhhh. Get you. I think it'll be impossible to do via html variable passing only, you've have to do a SQL statement and get the next / previous image that exists from your database. You could try to load the image and if there's no data, add on to / subtract from the variable and reload that page, but that's an ugly, ugly solution.
This all works very well, however the problem I'm having is that images -1 and 5 don't exist.
Pressing next will add 1 to "img" and pressing previous will deduct 1 from "img".
Obviously, I don't want it to display pics that don't exist.
if($img >= 0 && $img <= 10)
{ echo "True"; }
else
{ echo "False"; }
> so if you went to: index.php?img=3-8
>
> it would display a page with:
>
> low = 3
> high = 7
> ----------------
>
> Are either of those what you are looking for?
low = 3
high = 8
----------------
Don't try to say my code is bugged. ;)
index.php?img=0
index.php?img=1
index.php?img=2
index.php?img=3
index.php?img=4
index.php?img=5
index.php?img=6
index.php?img=7
index.php?img=8
index.php?img=9
index.php?img=10
whereas with Pandaemonium's script will turn a query string variable into the two limits of a range, so if you went to: index.php?img=3-8
it would display a page with:
low = 3
high = 7
----------------
Are either of those what you are looking for?
[edit] If anyones got an easier way to do this, I'd be interested. Nuts to passing arrays mind.
test.php
-=-=-=-=-=-=-=-=-=-
if (isset($HTTP_GET_VARS['img'])) {
$range = ($HTTP_GET_VARS['img']);
$split = strpos($range,"-");
$low = substr($range,0,$split);
$high = substr($range,$split+1,strlen($range));
echo "low = ".$low;
echo "
high = ".$high;
echo "
-------------------
";
}
?>
Link