I've been using the following code to echo lines from a text file before. Now I've tried to use the same thing to echo certain parts of a html page. Instead of converting the text to html, it simply displays the html source as text.
Code: Select all
<?php
// file() loads the contents of file.txt into an array, $lines
// each line in the file becomes a seperate element of the array.
$lines = array_reverse( file( '../pagetest.html' ) );
// we can also access each line of the file seperately
echo htmlspecialchars($lines[120]) . '<br />';
echo htmlspecialchars($lines[121]) . '<br />';Any ideas on what I can do to make this script handle the html as html rather than text?
Thanks in advance.