Re: Cannot get this one correct and working, though simple!
- From: "comp.lang.php" <phillip.s.powell@xxxxxxxxx>
- Date: 30 Dec 2005 08:16:58 -0800
Jofio wrote:
> I have 40 or jpeg files which I want them displayed in a frame called
> "main" upon clicking thumbnails of the same pics in a "leftMenu" frame.
> The thumbnail jpeg files are called thumb1, thumb2, thumb3, thumb4,
> ..., thumb40. These files are smaller versions (50pixelX50pixel) of the
> larger jpeg files called 1, 2, 3, 4, ..., 40 which I want them
> displayed.
>
> To display the hyperlinked thumbnails in the "leftMenu" frame I have it
> in a loop. [See the code snippet]
>
> But my problem is that part of the code ...<img src='thumb$i.jpg'> ...
>
> It doesn't display the intended thumbnail jpeg files; instead, it
> display the larger version of the files as thumbnails which takes
> longer to load.
>
[snip]
The problem lies in the way you embedded $i. PHP thinks you have a
variable literally called "$i.jpg" since a period is a valid implied
variable name character.
Try this instead:
<img src='thumb${i}.jpg'>
curly braces will separate out the valid variable name characters.
Phil
.
- Follow-Ups:
- Re: Cannot get this one correct and working, though simple!
- From: Oli Filth
- Re: Cannot get this one correct and working, though simple!
- From: Geoff Berrow
- Re: Cannot get this one correct and working, though simple!
- References:
- Prev by Date: Re: Listing objects
- Next by Date: Re: Cannot get this one correct and working, though simple!
- Previous by thread: Re: Cannot get this one correct and working, though simple!
- Next by thread: Re: Cannot get this one correct and working, though simple!
- Index(es):
Relevant Pages
|