How to convert HTML to PHP?

Discussion in 'After Hours Lounge (Off Topic)' started by David Baranyi, Sep 2, 2003.

  1. David Baranyi

    David Baranyi Stunt Coordinator

    Joined:
    Jul 17, 2003
    Messages:
    81
    Likes Received:
    0
    Good news, I was able to get register another domain name from an accredited registrar (DomainSite.com) and purchased a web hosting package (Future Point, Inc.) outside of FortuneCity. I do not know what is wrong with FortuneCity (I contacted it days ago and yet to receive a response), but it has lost my business. I had demanded a refund. Does anyone know who the registrar FortuneCity is affiliated with?

    Anyway, since I now own my domain name, I had been thinking of switching from HTML to PHP. Is there a way to convert my HTML files to PHP?
     
  2. Chris Hovanic

    Chris Hovanic Supporting Actor

    Joined:
    Jan 3, 2003
    Messages:
    545
    Likes Received:
    0
    Might want to bone up on php.... I dont think its a matter of switching from HTML to PHP.

    Check out http://www.php.net/ for some info. They have a introductory tutorial that you may want to check out.

    Good luck and let us know when your site is up and running!
     
  3. wally

    wally Second Unit

    Joined:
    Feb 12, 2001
    Messages:
    473
    Likes Received:
    0
    PHP is a scripting language. You can place PHP in an HTML document, but it does not replace it.

    Good luck!
     
  4. Greg Rowe

    Greg Rowe Stunt Coordinator

    Joined:
    Nov 29, 2001
    Messages:
    159
    Likes Received:
    0
    Real Name:
    Greg
    [​IMG]

    As wally said, php is a scripting language. The *output* of your php scripts is usually HTML. See www.php.net for excellent documentation.

    Greg
     
  5. Robert Ma

    Robert Ma Second Unit

    Joined:
    Jun 18, 2001
    Messages:
    368
    Likes Received:
    0
    I'm a Perl nut myself, PHP's daddy. You want to keep using HTML and then use PHP for database back end or form handling. I believe Wally said that PHP can be in a HTML doc but I do not think that is accurate. JAVA or VBScript yes but if PHP is like perl, it's strickly server side and the browser doesn't have any way running a PHP script.
     
  6. Patrick Larkin

    Patrick Larkin Screenwriter

    Joined:
    May 8, 2001
    Messages:
    1,759
    Likes Received:
    0
    Well, you can send HTML to the browser using PHP like:

    PRINT "html code here";

    But there really is no point unless you are doing something else with php to warrant its use.
     
  7. nolesrule

    nolesrule Producer

    Joined:
    Aug 6, 2001
    Messages:
    3,084
    Likes Received:
    0
    Location:
    Clearwater, FL
    Real Name:
    Joe Kauffman
    PHP can be dropped into an HTML document just like ASP or Cold Fusion, all of which are handled server-side by their engines before being sent through the web server. SO yes, HTML and PHP can be mixed.

    Don't confuse server/client-side with how it is parsed serverside.

    Just make sure that you use the right file extension so that the web server knows to call the engine first. In the case of PHP, the extension is usually ".php".
     
  8. Robert Ma

    Robert Ma Second Unit

    Joined:
    Jun 18, 2001
    Messages:
    368
    Likes Received:
    0
    You can imbed html in php but I still do not get how you imbed php into html. By using the .php extension, the web server will toss the php script to the php engine or isapi filter in MS IIS's case. That is not a html file that is running serverside code. Is there a way to call PHP code imbeded in a html file?
     
  9. Patrick Larkin

    Patrick Larkin Screenwriter

    Joined:
    May 8, 2001
    Messages:
    1,759
    Likes Received:
    0
    So, you want php code to execute within a file with an .html extension? You'd have to set that in your webserver. You tell it what extensions to parse for php code.

    For instance, in Apache, you'd enter the following in your config file:

    AddType application/x-httpd-php .html

    This will result in the php engine parsing every page on your site which depending on your traffic will slow things down.
     
  10. Robert Ma

    Robert Ma Second Unit

    Joined:
    Jun 18, 2001
    Messages:
    368
    Likes Received:
    0
    Ah, I wouldn't ever want to do that but was just interested.
     

Share This Page