I need to include a header file in some HTML pages. However, I have an issue with these .html pages not working when converted to .php files. I do not know why this is. The files are from a script purchased from Themeforest who no longer support the product.
What I would like to know is, can I include other HTML files within another HTML file?
I have found this:
But wondered if this is the correct way about it, or if there are better ways?
Hi, I guess your site is hosted on a server using PHP.
Files with the .php extension contains php scripts that are meant to be processed on the server and usually combines html with php commands to output a html page and send as a respons to the browser.
Please read more about how to include files in PHP:
Thanks for the link. I don’t think I do have access to it. My host uses Plesk so will look into that or ask them. When I connect to FTP, I only have httpdocs as the root and not in the /etc/httpd/conf as described
So you are trying SHTML includes. I assumed from the initial question you were trying PHP includes. Or did you try that too?
Assuming PHP is running on your server, it should be fairly straightforward to do.
The script I am running doesn’t seem to run when I change the extension to .php (they are .html files with angular, but it doesn’t seem to like PHP), otherwise I would use PHP includes which would work fine.
When I try to change the extension to .php, the pages load blank.
Glad you got it sorted. Just as a note, if it doesn’t contain any SSI, the file you’re including (in this case header.shtml) doesn’t need to have an SHTML extension; it can be just HTML.