You are here: Re: Can't Escape « PHP Programming Language « IT news, forums, messages
Re: Can't Escape

Posted by Confused but working on it on 09/11/07 22:02

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация