Friday, May 21, 2010

How do you format a txt file to display in php page?

Hi,





I have imported a .txt file into my .php page.





How do I insert line breaks, new paragraphs etc into the txt file so that:





This is line 1 this is line 2 this is line 3





shows as





this is line1


this is line 2





this is line 3





Thanks

How do you format a txt file to display in php page?
how did you import the txt file into the php file?





did you use "include 'textfile.txt' ;"?


or "virtual 'textfile.txt';"?





basically everything you write in a php file will be rendered as html


so you write the normal html in the txt file


contents of text file:





%26lt;p%26gt;this is line1%26lt;'br' /%26gt;this is line 2%26lt;/p%26gt;%26lt;p%26gt;this is line 3%26lt;/p%26gt;





there is also the "\n" that will create a break in the source code





text will be shown on the php web page, whitch you need to view through a virtual/normal server on a browser





just viewing the file with internet explorer will not work





im not sure that i explained it right





this is just an idea, i haven't tried it


No comments:

Post a Comment