Adding PHP code to a .shtml page

Posted on 2007-10-04
Last Modified: 2013-12-13
I have written several web pages with the file extension .shtml containing  <!--#include virtual="Include/" --> 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/" --> 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.
Question by:cobra502
    LVL 48

    Expert Comment


    Guess you need to name to NavigateG2.php or you need to add the extension .inc to be pared as a php-file

    Accepted Solution

    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

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now