How to load an HTML file into an included PHP file from another PHP?
Posted
by
Peter NGM
on Stack Overflow
See other posts from Stack Overflow
or by Peter NGM
Published on 2012-09-04T09:34:41Z
Indexed on
2012/09/04
9:38 UTC
Read the original article
Hit count: 362
i have 2 PHP file and 1 HTML.
i want to include file2.php in file1.php.
file1.php is:
<html>
<head>...</head>
<body>
...
<?php include("file2.php"); ?>
...
</body>
</html>
i want to load an HTML file in file2.php:
file2.php is:
<?php
$doc = new DOMDocument();
$doc->loadHTMLFile("sample.html");
echo $doc->saveHTML();
?>
and sample.html is:
...
<b>Hello World!</b>
...
my problem is this error:
Warning: DOMDocument::loadHTMLFile() [domdocument.loadhtmlfile]: I/O warning : failed to load external entity "sample.html" in C:\xampp\htdocs\project\file2.php on line 3
please help me to solve this problem.
© Stack Overflow or respective owner