i wanna show in my site the content of road.txt in a cell. If in the file said the history of roads in Germany, i wanna show that in the website, like regular text to the reader.
Please if you don´t understand tell me
i wanna show on the screen with a html format a txt file that doesn´t have a format only text.
@NogDogJun 23.2006 — #[EDIT]Charles more-or-less beat me to the punch while I was typing (and watching TV). ? [/EDIT]
In this case, just to make sure nothing in the text file messes up the document's HTML syntax (or even gets interpreted as being PHP code), I might do: [code=php] <td><?php echo htmlentities(file_get_contents("textifle.txt")); ?></td> [/code] Also, if you want to maintain the line breaks in the text file: [code=php] <td><?php echo nl2br(htmlentities(file_get_contents("textfile.txt"))); ?></td> [/code]
@CharlesJun 23.2006 — #As if we needed it, there's more proof the TV is bad for you.
I like the "n2br" but I don't like your use of double quotes. Double quotes support variable substitution while single quotes do not. That means that double quotes carry a much heavier overhead.
@the_treeJun 23.2006 — #Really, is it actually a significant amount on small to medium sized sites? I tend to use single quotes when there's a choice anyway but never out of concern for server load.
@CharlesJun 23.2006 — #Really, is it actually a significant amount on small to medium sized sites? I tend to use single quotes when there's a choice anyway but never out of concern for server load.[/QUOTE]Regarding server load, "Never increase, beyond what is necessary," that what I always say.
I haven´t work with php before so i don´t know that much, but, i just copy what you wrote and put it on my code, in the html files, but still it doesn´t work.
Should i have to write something beside this. There is no problem with the file name or location, i already check that one
the code is not in div tags or p tags, it is only in the code you pass me.
@CharlesJun 23.2006 — #Give your file a ".php" extension and not ".html" and use the following just to be sure:[code=php]<?php echo file_exists ('file.txt') ? nl2br (htmlentities (file_get_contents ('file.txt'))) : ' ' ?>[/code]