.htm or .php, which is better?

Discussion in 'PHP' started by hhheng, Jun 18, 2007.

  1. #1
    Part of my website is static, and others will be .php. For the static pages, I want to also save them as .php files. Does it make any difference from save as .htm files? Will this affect the downloading speed for visitors while viewing my static pages?
     
    hhheng, Jun 18, 2007 IP
  2. HuggyCT2

    HuggyCT2 Guest

    Messages:
    222
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No there is no difference.
     
    HuggyCT2, Jun 18, 2007 IP
  3. frankcow

    frankcow Well-Known Member

    Messages:
    4,859
    Likes Received:
    265
    Best Answers:
    0
    Trophy Points:
    180
    #3
    No, but if you can work with PHP, do it. It will be much easier for templating
     
    frankcow, Jun 18, 2007 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    Yes, but the difference won't be noticeable. By default, PHP parses all files with an .php extension before it sends the output to the browser. That means it checks for <?php tags and parses the content of them. (If any).

    While .html files won't be parsed by default. So they're served directly.


    But this is really nothing you should worry about. The difference is so small, no one would ever notice.
     
    nico_swd, Jun 18, 2007 IP
  5. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #5
    If your pages are just plain html there is no reason to work with PHP. It can't provide anything for you but slow down your web site due to the extra resources it takes due to the php interpreter. Web servers can serve a significant amount of static pages compared to interpreted language pages I'm just not sure how much of an effect just running the interpreter itself will do on server resources without it actually doing any real logic.
     
    InFloW, Jun 18, 2007 IP
  6. hhheng

    hhheng Banned

    Messages:
    2,633
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #6
    The reason I want to save as php is that I can use <? include header.php; ?> to share the same header and footer for all the pages. I don't like using the html templates. As frankcow said, php is very good for templates.

    So if I save the .htm files as .php, the only codes will be the <? include header.php; ?>. Will this affect too much on the speed? Or are there any other good choices to share the same header or footer in .htm files?

    BTW, I have only around 15 pages for my website.
     
    hhheng, Jun 18, 2007 IP
  7. CygnetGames

    CygnetGames Peon

    Messages:
    43
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #7
    You shouldn't notice any difference in speed just using php to include a header and footer.
    If in doubt - test it out and see - I bet you won't notice any difference at all.
     
    CygnetGames, Jun 18, 2007 IP
  8. Lemezo

    Lemezo Active Member

    Messages:
    429
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    75
    #8
    There is a big difference between php and html. It's not the same type, so you can't actualy ask .htm or .php.
     
    Lemezo, Jun 18, 2007 IP
  9. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #9
    the only difference between the two is that one is sent through the parser, and one is not. it's a matter of milliseconds, you'd never notice the difference.
     
    ansi, Jun 18, 2007 IP