Include statement not working in a script-generated htm file

I’m using the following code to open/create a new .htm file:
if (file_exists($filename)){
$file_handle = fopen($filename, “wb”);
}
else {
$file_handle = fopen($filename, “xb”);
}

The rest of the script writes the content of the file correctly. There’s an include statement in the new .htm file that refers to a .css file. When I view the new .htm file, it is not formatted per the .css file. In the source, I find the include statement rather than the style tags from the .css. However, if I open the file for editing on the server and save it (without making any changes), the formatting is correct when opened again for viewing and the source shows the style tags instead of the include statement.

I’m going to try changing the include to the traditional “link” html statement for stylesheets, but I’m hoping to find a resolution to this for future use when I may not know of another alternative.

Show us the .htm file that works and the one that doesn’t. This will help us see any differances.

Also, when you say “include” into an .htm page, do you mean a PHP include, because if so, of course that isn’t going to work. Its not a php page being sent through a PHP parser.

UNLESS of course you have your PHP parser process .htm pages. This is a very simple thing to do as well. The down side is that EVERY .htm (or whatever) page will go through the parser. If you have a lot of “Static” pages, it could possibly slow up the serving of pages. I have not really noticed a difference, however, in my server that I have this set on.

Sponsor our Newsletter | Privacy Policy | Terms of Service