You are here: Re: Firefox/Explorer problem « PHP Programming Language « IT news, forums, messages
Re: Firefox/Explorer problem

Posted by Rik on 07/05/06 14:11

Dan Pearce wrote:
> Processing some text from an external text file into a web page. If I
> use this:
>
> <?
> $s = file_get_contents('text.txt');
> $search = array("@\r\n@si");
>
> $replace = array('</br>');

Here's you problem already:
It should be '<br />' in XHTML, '<br>' in HTML.

> echo preg_replace($search, $replace, $s);
>>
>
> Explorer shows the text as it appears in the file;

Apparantly MSIE forgives your mistake and chooses to interpret '</br>' as
'<br>'. FF correctly interprets it as a bogus tag and tries to ignore it.

Why not use the function nl2br() though?
Or, if you have a text-file with preformatted text, use the HTML <pre> tag.

Grtz,
--
Rik Wasmus

 

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

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