1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Convert HTML Pages to PHP

Discussion in 'HTML & Website Design' started by profezor, Feb 23, 2008.

  1. #1
    A quick search solved the problem,
    thanks
    This thread can be closed
    ________________________________________

    a quick and easy one.

    I have a bunch of pages in html, but I need to add a dynamic php element.
    As result i must convert them to .php. What is teh easiest way to do that?

    Can I just change the ext ? Or must I also add the <?php> at the top and bottom and if so where exactly?

    Thanks in advance

    profezor
     
    profezor, Feb 23, 2008 IP
  2. vishnups

    vishnups Banned

    Messages:
    166
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Just where yo need the element.
    <?php

    your php code

    ?>

    No need to insert it at the top of page. The php parser will parse the script when it views the above tags.
     
    vishnups, Feb 23, 2008 IP
  3. webrehash

    webrehash Peon

    Messages:
    163
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Just include the html extension in your htaccess file to be processed as php. Like this:

    AddType application/x-httpd-php htm html php
    AddHandler application/x-httpd-php .htm .html

    Then you can add your php code into your html file, and it will output correctly with the html extension. Checkout my "free dreamweaver extensions" link in my sig. That site is all dynamic php, but the files are all html out of Dreamweaver.
     
    webrehash, Feb 26, 2008 IP
    SgtRumble likes this.