jimneely Posted January 24, 2014 Share Posted January 24, 2014 I have my main page set up as html. I am using php to pull in a text file. I can (on its own) read a text file but when i add the php code to the html it does not work. Help please. <?php /** * * * @version $Id$ * @copyright 2014 */ // Read 14 characters starting from the 21st character //$section = file_get_contents('./people.txt', NULL, NULL, 20, 14); //$section = file_get_contents('C:/users/jneely/desktop/test.txt', true); //$section = file_get_contents('\\s-dmf\data\M200\TM-0731\FunctionTest\Archive\14011623595241162401B.txt', true); $section = file_get_contents('//s-fs2/attachments/test.txt', true); //var_dump($section); echo( $section); ?> My html..... $rightcolumn = <<< EOF <a href="http://example1.com/">QPR</a> <br/><a href="http://example2.com/">Deviation</a> <br/><a href="http://example3.com/">Boundary Samples</a> <br/><a href="http://example4.com/">TPC</a> <br/><a href="http:readtextfile.php">Test</a> <br/><a href="http://example6.com/">Link 6</a> EOF ; Quote Link to comment https://forums.phpfreaks.com/topic/285640-read-a-text-file-into-my-web-page/ Share on other sites More sharing options...
cyberRobot Posted January 24, 2014 Share Posted January 24, 2014 Is the page named with a .php extension? Note that PHP isn't parsed in .html files...unless the server is configured to do so. Quote Link to comment https://forums.phpfreaks.com/topic/285640-read-a-text-file-into-my-web-page/#findComment-1466415 Share on other sites More sharing options...
jimneely Posted January 25, 2014 Author Share Posted January 25, 2014 The html is a index.php that is eof and the ReadTextFile is php. Of the code submitted the first is the ReadTextFile and the second part is the EOF of my main HTML that is index.php. I hope this helps Quote Link to comment https://forums.phpfreaks.com/topic/285640-read-a-text-file-into-my-web-page/#findComment-1466454 Share on other sites More sharing options...
kicken Posted January 25, 2014 Share Posted January 25, 2014 What exactly do you expect your anchor tag for readtextfile.php to do? If you want it to load that PHP file, you need to fix the href to actually point to that file, right now it's pointing to some non-existent http:readtextfile.php. Quote Link to comment https://forums.phpfreaks.com/topic/285640-read-a-text-file-into-my-web-page/#findComment-1466520 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.