I currently have the following pieced together to include a file (unformatted plain text file) on a webpage: <?php $URL = "http://mysite.com/".$page.""; include ("$URL"); ?> The include works fine however when viewing the webpage with the include the page appears as: apple banana mango I have been trying without success now to get the included plain text file to have <br /> so that it will display as: apple banana mango What is the way to do this. I have played around with str_replace and preg_replace but my knowledge of php is very basic (non-existant). Thanks for any help.
I am not able to relate $URL with apple mango and banana ... could you give better example ? Assume that include tag would only copy the content of file / data you wish to include, so if I add include in a page called mypage mypage {--------------lots of code--------------------} addthis {somecode} so if i include addthis in mypage... mypage {--------------lots of code----------- include (addthis)---------} it (mypage) would be finally processed as mypage {--------------lots of code-----------{somecode}---------} HTH,
OK, not too clear.. <?php include ("http://mysite.com/".$page.""); ?> Code (markup): ...includes an plain text file in the page. I would like to somehow edit the file before it is displayed. i.e. replace the space or newline which it has now, with <br />
I know that would work, but i need it in 2 different formats on 2 websites. Which is my i am trying to do it..
OK found a solution here in case anyone else is looking: http://www.builderau.com.au/program/php/soa/Transform-plain-text-files-into-Web-pages-automatically-with-this-PHP-script/0,339028448,339272897,00.htm