Discussion: Can't Escape
Afficher un message
Vieux 12/09/2007, 00h02   #5
Confused but working on it
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Can't Escape

On 2007-09-11 14:50:53 -0700, Michael Fesser <netizen@gmx.de> said:

> .oO(Good Man)
>
>> Confused but working on it <PostInGroups@wherever.com> wrote in
>> news:2007091114413816807-PostInGroups@wherevercom:
>>
>>> <?php
>>> //NOT WORKING - shows the little blue question mark box
>>> echo "<img src = \"/DSC01351.jpg\">";

>>
>> This means: show an image, the source of which is at the top of the
>> server. Perhaps you should put the entire path to the image, relative
>> to where your PHP script is being called from.
>>
>> echo "<img src=\"path/to/my/image/DSC01351.jpg\">";

>
> Additionally HTML also allows single quotes, which avoids the ugly
> escaping:
>
> echo "<img src='path/to/my/image/DSC01351.jpg'>";
>
>> according to your script, the images are located in the directory
>> "images". therefore, you need the directory name in addition to the
>> image name. should be:
>>
>> echo "<img src=\"images/".$file."\" alt=\"my image\">";

>
> echo "<img src='images/$file' alt='my image'>";
>
> I find that much more readable.
>
> Micha


Wow, Thanks!
I didn't even think to try adding the images/ part to the line. Figured
it was outputting the filename so...

Mixing single and double quotes in the case eliminates the need to
escape I take it.

Now it appears I have files named "." and "..", well, back to the manual...

Thanks again

  Réponse avec citation
 
Page generated in 0,31730 seconds with 9 queries