Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

Adding PHP code to a .shtml page

I have written several web pages with the file extension .shtml containing  <!--#include virtual="Include/NavigateG2.inc" --> in them and everything works okay. I have added some PHP to these web pages and I now have problems.
When I continue to use file extension .shtml the php code does not get parsed. When I use the file extension .php my <!--#include virtual="Include/NavigateG2.inc" --> data is missing from the screen. I assume it is not getting parsed because the file extension is not .shtml.
My question. What file extension should I be using and what should the code look like to get these two functions to co-habitat in the same page?
Thanks for your time and help.
1 Solution
See http://forums.hostrocket.com/archive/index.php/t-2234.html


Guess you need to name NavigateG2.inc to NavigateG2.php or you need to add the extension .inc to be pared as a php-file
cobra502Author Commented:
I have figured it out. I created a file using the php code I wanted to put into the shtml file and saved it as getphpcode.php. Then using the original .shtml program that was working okay, I added
        <!--#include virtual="getphpcode.php" -->
to the .shtml program.
So I guess the include is handled by the server and when the server sees the php code it parses it.

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now