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.

html or php?

Discussion in 'HTML & Website Design' started by JasMate, Jul 27, 2006.

  1. #1
    I have the option to create my pages in either html, htm or php. I usually just use html or htm as my page extensions but recently I have found that some dynamic content prefers php for the scripts to run properly so I am seriously considering doing new sites in php & even changing one of my old sites over to php.

    Now I guess my main questions are this:

    1) To do php extenstions can I just do a normal html page & then save it as .php? Or does the code need to be different?

    2) How do the search engines feel about php do they treat it the same as html?

    3) Lastly is there any negatives you can think of doing sites in php instead of html?
     
    JasMate, Jul 27, 2006 IP
  2. jackburton2006

    jackburton2006 Peon

    Messages:
    5,296
    Likes Received:
    282
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you know how, do it in php. You would be foolish to do it in html especially if you plan on a big site. By now every search engine worth its salt reads php just as well as html.
     
    jackburton2006, Jul 27, 2006 IP
  3. bilzo

    bilzo Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    1) Yes, you can just name a regular HTML document with .php or .phtml without having to change the code... But if you then add php code it will be recognised as such!

    2) Yes should be picked up just the same

    3) Not that I can think of

    Bill
     
    bilzo, Jul 27, 2006 IP
  4. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #4
    Thanks Bill, just to make sure you are saying that I CAN rename a standard html file with the .php extension and it will run as php and I will be able to run php scripts inside the code?

    Thanks:)
     
    JasMate, Jul 27, 2006 IP
  5. dotcompals

    dotcompals Prominent Member

    Messages:
    2,905
    Likes Received:
    254
    Best Answers:
    0
    Trophy Points:
    320
    #5
    1) To do php extenstions can I just do a normal html page & then save it as .php? Or does the code need to be different?

    You can do a normal html page & then save it as .php

    2) How do the search engines feel about php do they treat it the same as html?
    if u use php, it will be rendered as html in the browser.. so no difference.

    3) Lastly is there any negatives you can think of doing sites in php instead of html?

    Nothing...
     
    dotcompals, Jul 27, 2006 IP
  6. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If the pages are already indexed, I wouldn't change the extension as it won't be the same page.

    If you want to add php code, you can do so easily on any page extension.

    If you haven't already just open the htaccess file in the root and add

    AddType application/x-httpd-php .html .php .htm
     
    yfs1, Jul 27, 2006 IP
  7. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #7
    Ok good advice there, so it would be a waste of time and effort changing an existing site into php. Appreciate the time saving advice there. So what you are saying is add this line of text to the htaccess file: AddType application/x-httpd-php .html .php .htm And that will allow me to run php scripts within the html of a .html page?

    Thanks :)
     
    JasMate, Jul 27, 2006 IP
    yfs1 likes this.
  8. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Absolutely, This site has a ton of php includes on it (Like include_once ('footer.php);, etc) to make it easy to update but notice the extensions.

    I know php but sometimes I like using it for just includes on an css driven html site

    It all depends on your level of knowledge
     
    yfs1, Jul 27, 2006 IP
  9. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #9
    Great! thanks again that will save me a swag of time - by the way nice site you got there ;)
     
    JasMate, Jul 27, 2006 IP
  10. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #10
    One last thing....You can check with your host to make sure they support PHP but to be honest it would be rare if they didn't (and in fact it would mean it was a pretty bad host and you should switch)

    Try a bit of php on one page and post back in this thread if you have any issues

    Cheers
     
    yfs1, Jul 27, 2006 IP
  11. bilzo

    bilzo Peon

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    That's very true - if your pages are alreay indexed and you change the file extension the SEs will see them as different pages. If you do change extensions (for whatever reason) you can keep the old page ranking by using 301 redirects...
     
    bilzo, Jul 27, 2006 IP
  12. codyturk

    codyturk Well-Known Member

    Messages:
    339
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    128
    #12
    Developing a site in php with mysql is amazing. If you are planning on developing a large site with a database I recommend php with mysql. :)
     
    codyturk, Jul 27, 2006 IP
  13. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #13
    Ok yeah. So I guess another question would be is there any reason at all why other people don't just save there html as .php for future options? Why do most people stick with .html? For future sites I can see saving the extension in .php is much better but are there any negatives? If not (as one poster said there isn't) why does't everyone save as .php and have all their site in this language?
     
    JasMate, Jul 27, 2006 IP
  14. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #14
    You can just write 1 line in your htaccess file to make html pages parse as if they were php pages. Even html sites can run php scripts so it really makes no difference.
     
    mad4, Jul 27, 2006 IP
  15. yfs1

    yfs1 User Title Not Found

    Messages:
    13,798
    Likes Received:
    922
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Some of us (unfortunately) are still a bit old school and use html with php in it for fairly simple sites.

    I would agree though if you are creating a completely dynamic site its best to just go with .php from the beggining.
     
    yfs1, Jul 27, 2006 IP
  16. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #16
    Yeah thanks for that I did think that was the case. So cool I know what I need to do now you've been very helpful ;)
     
    JasMate, Jul 27, 2006 IP
  17. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #17
    One thing to consider; if you run everything through the PHP parser/interpreter, you are increasing the load on the server. For a high volume site, this could be significant.

    FWIW,

    gary
     
    kk5st, Jul 27, 2006 IP
  18. atlantico

    atlantico Active Member

    Messages:
    605
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #18
    If you just need to include PHP scripts into your HTML page, you can stay with HTML (btw, your php files can have .htm or .html extension, you just need to add a line to .htaccess file; as a result the server will parse HTML files just like normal PHP files). It's even possible to use PHP and SSI (.shtml) together, like I do on qesign.com (although, I would not recommend it as there're some limitations and "side effects").
    If you have enough skills, build a PHP site.
     
    atlantico, Jul 27, 2006 IP
  19. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #19
    I don't really have any php coding skills, I was just going to creat normal html site in dreamweaver and then save the pages as .php
     
    JasMate, Jul 27, 2006 IP
  20. Mystique

    Mystique Well-Known Member

    Messages:
    2,579
    Likes Received:
    94
    Best Answers:
    2
    Trophy Points:
    195
    #20
    forcing the server to parse html pages as php via .htacces is easier than rename your files.

    Make php pages with no php coding serves to make people believe your page is dynamic when it is not, but from the server perspective, you are wasting resouces that way.

    For future development, using php extension or htaccess to parse simple html pages enable you to integrate php snippets or basic coding without having to do the changes then :rolleyes:
     
    Mystique, Jul 27, 2006 IP