My code currently looks something like:
echo "<pre>" include $textfile echo "</pre>";
but the output 'erases' all of the html tags. Is there a way to keep the html tags and have php output exactly how what it says/how it is formatted in the text file?
Thanks!
Need not echo it....try to include like
include $textfile;
Dont know exactly what you mean but you could try this:
echo file_get_contents($file);
strip_tags($textfile);
Allow tags:
// Allow <p> and <a>
echo strip_tags($text, '<p><a>');
?>
The problem is how you're trying to use include.
This is the correct syntax.
include("./pathtofile/htmlfile.inc");
The file you include does not have to have any special extension at the end of it so .html will still function properly. If the included text is HTML and has html tags, be sure to not put <?php and ?>
tags in that file or else it will parse them as php, which you don't want since there aren't echo statements. You will have the include() call be inside PHP tags in the main program though.
What ever the code you have nothing to do with the stripping of html tags/formatting. Please provide us the complete code you have, so that we may assist you.