Do I need to change page name to use php scripts?

Discussion in 'PHP' started by IanT, Apr 4, 2010.

  1. #1
    For instance, if I include a php menu script that calls to a file (menu.php) to be displayed in a div, do I need to change the name of the page that the call to script is located to a .php, or can I keep it as .html and still have the script run correctly?

    kinda confused about that?

    thanks!
     
    IanT, Apr 4, 2010 IP
  2. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You do have to change the page name that has the include() script in it to .php. If you don't, the code will not parse.
     
    Imozeb, Apr 4, 2010 IP
  3. -Ray-

    -Ray- Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you can use incude(); to include and page type or image type as long as the host supports the server side launagage.
     
    -Ray-, Apr 5, 2010 IP
  4. Amator

    Amator Well-Known Member

    Messages:
    1,424
    Likes Received:
    55
    Best Answers:
    0
    Trophy Points:
    165
    #4
    You don't have to change the extension if the host configured php to run with other extensions.
    But I think mosts hosts define only .php
     
    Amator, Apr 5, 2010 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #5
    To get regular html pages to handle php code, you need to add this line to a .htaccess file.
    AddHandler application/x-httpd-php5 .html .htm
    PHP:
    <?php
    include 'menu.php';
    ?>
    PHP:
     
    MyVodaFone, Apr 5, 2010 IP