Not signed in (Sign In)

SkillShare - A place to discuss Web Standards and Web Design topics

Categories

Vanilla 1.1.5a is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthormihai
    • CommentTimeJul 10th 2006 edited
     permalink
    hello everyone,
    i'm trying to include in a .html file some php scripting like this:
    <html><body>
    <?php include("top.php"); ?>
    </body></html>

    but i can't seen to get it work :(( any suggestions... ?, it works if i use the extension .php for the file in witch i include top.php

    10x everyone
    •  
      CommentAuthornifkin
    • CommentTimeJul 10th 2006
     permalink
    You need to save your files with a .PHP extension to tell the server that they need to be run through the PHP interpreter.

    (Or talk to your server admin about having your server run all HTML files through the interpreter as well, but that's typically unnecessary since if you just adjust the file extension it should work fine.)
  1.  permalink
    Yeah, you'd need the .php file extension as nifkin said. In the past year I've actually started giving all my pages a php extension just to be on the safe side as it's become pretty common to necessitate adding little inline php functions as the client requests them later on in the project.
    • CommentAuthordhayes
    • CommentTimeJul 10th 2006
     permalink
    you could also add the type/handler to your htaccess:

    AddType application/x-httpd-php .html
    AddHandler application/x-httpd-php .html
    • CommentAuthormihai
    • CommentTimeJul 10th 2006
     permalink
    yea 10x for the infos, the company that i am making some stuff wants all their files named .html (stupid idea if u ask me, of not).
    but 10x anyway, off i go to call their IT guy... again :D

    Mike
  2.  permalink
    Or you might try mod_rewrite to change the extensions to .html (not sure at all whether it will actually work on your server)

    try this in your .htaccess file:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^(.*)\.php $1.html [R=301,L]
    RewriteRule ^(.*)\.html $1.php [L]

    This way you can refer to top.php as top.html.
    • CommentAuthordhayes
    • CommentTimeJul 11th 2006
     permalink
    mod-rewrite won't actually invoke the processor. the type and handler need to be set for apache to recognize and initiate the proper handler(s) for the given document.
Add your comments
    Username Password
  • Format comments as (Help)