I have read online that it is possible to combine both html and php into onedocument, but in most cases the examples have always proceeded to give the file the .php extension.

I am curious if you can include php in a document with the .htm or .html extension.

Thanks in advance,
shimano55

    Yes you can include the php code in HTML...

    to include php code into html, you have to use <? php........................?> tags.

    An example for that is:

    <html>
    <head></head>
    <body>
    The date at this moment is:
    <?php echo gmdate("M d Y");
    ?>
    </body>
    </html>

    I hope i have solved your query.......

      You can write plain HTML into a php document, just like azamatali showed, but you have to call the file .php or the php-code wont get executed...

        o ok

        thanks for the info guys...I kinda thought as much but just making sure 😉

          akillez is wrong: you can use any file extention you want, just so long as you tell Apache and PHP about it. See:

          http://uk2.php.net/manual/en/install.apache2.php

          (assuming of course you are using Apache 2, otherwise start at http://uk2.php.net/manual/en/installation.php#install.general)

          You need to include the correct statements in httpd.config and php.ini to use the file extentions that you desire. You can even configure the system to parse php tags in an html file, or could back in 2001 when I was last doing web server admin.

            im not sure if I have that range of movement....AT ALL
            lol

            see..here's my situation:

            I'm using Typepad...which is a branch off of movable type in which the typepad "people" host you. At the moment, I have the most basic level of typepad, and I was wonderig if i could add php code into the editors on typepad.

              Don't know who or what typepad is I'm afraid. Speak to their technical support about it. I'm dependent upon my Host's techies myself; can't edit config or ini files so I have to use whatever file extensions they have set up. If they have installed PHP then they will have enabled some file extention or other, if not then nothing will understand the php statements.

                or you could hook up your tv with your pc and write a program to change the channels!!
                errr wait... that's right... I already have a remote :glare:

                /me wanders off with a lollypop 😉

                  Ok akillez, point taken.

                  Thing is the man asked if it was possible, not if it was easy, or worthwhile.

                  Now given the security holes that php can leave open into a server and its host network, security holes that are partly addressed in ver 4.2 by defaulting to register_globals off; and the fact that many isps have not followed this when upgrading; I would prefer NOT to advertise the fact that I am using php on my website.

                  Would not matter so much if it was just a bulletin board, or a fanzine, or such like; but our company site has an online payment system which always makes you a target. The new development that has led me back to using php/mysql is for clients to track their work. Confidential data for our clients, and also confidential data about their clients which is covered by the data pretection act, and our membership of the CSA. So yes, I have a bee in my bonnet about correct server configuration, about what is and is not possible.

                  Also, shimano55 appears from his comments to be tied to file extentions other than php, so my answer was: on topic, informative, accurate, complete and relevent. That is what I want for an answer when I post, and what most newbies want when they post here.

                  And no, I'm not averse to humour, sarcasm, or wit. I'm just sitting here twiddling my thumbs waiting for the tech support at our isp to get back to me with access to mysql privilege system so I can code my pages to connect to my db with a user id that does not have create and drop table and database privileges. If I was not, I'd not be answering posts with a diatribe like this.

                    Write a Reply...