1. Welcome! Please take a few seconds to create your free account to post threads, make some friends, remove a few ads while surfing and much more. ClutchFans has been bringing fans together to talk Houston Sports since 1996. Join us!

HTML to PHP

Discussion in 'BBS Hangout' started by Lil Pun, Sep 19, 2006.

  1. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038
    How difficult is it to turn a HTML page into a PHP page? What advantages, if any, does a PHP page hold that a HTML or XHTML page doesn't? What are the disadvantages, if any? I am building my own, personal website and I am just wondering about these things.
     
  2. OldManBernie

    OldManBernie Old Fogey

    Joined:
    May 5, 2000
    Messages:
    2,852
    Likes Received:
    221
    It all depends on what kind of dynamic content do you need. HTML code works just fine in PHP. In fact, it's just like HTML except the embedded PHP code needs to be surrounded by <? and ?> tags.
     
  3. rockbox

    rockbox Around before clutchcity.com

    Joined:
    Jul 28, 2000
    Messages:
    23,019
    Likes Received:
    12,918
    php is only good if you want to have dynamic content created on the server side. If you don't, then don't even bother.
     
  4. SwoLy-D

    SwoLy-D Member

    Joined:
    Jul 20, 2001
    Messages:
    37,618
    Likes Received:
    1,456
    Do you understand that, unlike HTML, PHP requires a parser on the web server to interpret functions that HTML does not have? It's not just an extension or a name of the file. PHP is on your web server installation and will only parse tags in the PHP format, which looks like: < ?php > (no spaces).

    PHP is like ASP and Perl, they write HTML based on functions on the server's software.

    HTML is not a programming language, but PHP is. What or how were you persuaded or became curious about PHP?
     
  5. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038
    I eventually want dynamic content after I learn my XHTM and PHP some more. So if I understand you guys correctly to turn my page into a PHP one I would just adde <php?> and <?> around my html code? The I would rename it right for example from php.html to php.php?
     
  6. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038

    Well I am taking a XHTML class and we were briefly introduced to it in the last chapter but I would like to learn more. I went and bought another book to help me learn that as well.
     
  7. SwoLy-D

    SwoLy-D Member

    Joined:
    Jul 20, 2001
    Messages:
    37,618
    Likes Received:
    1,456
    Go to www.php.net . The introduction pages, like the "hello world" and the explanations, are great ways to learn. (Chapter 10)

    If you can get your hands on the demo for DreamWeaver, they have database-driven tutorials for PHP that can be easily deciphered once you know what code is written.

    My only advice to learn "MORE" is to learn ALL the HTML you can before you can go on to PHP. Try the "Beginner's Guide to HTML" (google it).

    It's cool you want to take the next step, man. CRAWL, then WALK, then RUN.
     
    #7 SwoLy-D, Sep 19, 2006
    Last edited: Sep 19, 2006
  8. OldManBernie

    OldManBernie Old Fogey

    Joined:
    May 5, 2000
    Messages:
    2,852
    Likes Received:
    221
    That's correct, but be sure you are on a webhost with PHP support. In a nutshell, it is almost like HTML except the PHP code determines what displays as HTML within the PHP block. I hope that makes sense to you.
     
  9. rodrick_98

    rodrick_98 Member

    Joined:
    Oct 26, 2000
    Messages:
    4,362
    Likes Received:
    6
    this page is perfect timing... my buddy and i are workin on changin our site from HTML to PHP... obviously all the links have to be redirected from index.html to main.php

    any suggestions to make this easier, rather than the tedious process of changing each page?
     
  10. SlvrBtl

    SlvrBtl Member

    Joined:
    Feb 22, 1999
    Messages:
    258
    Likes Received:
    3
    the easiest, i think, would be to do a mass change on either homesite or dreamweaver.
     
  11. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038
    Can't you just change the code up in the index.html file and the rename it .php?
     
  12. OldManBernie

    OldManBernie Old Fogey

    Joined:
    May 5, 2000
    Messages:
    2,852
    Likes Received:
    221
    yup... when designing a page, I'd start with the html to develop the look and feel of the page. After that is complete, then I'd work with the dynamic content with PHP.
     
  13. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038
    One thing I don't get, why do you have to rename the file .php? Will the php code not get recognized otherwise on the server side if it is still .html?
     
  14. DrLudicrous

    DrLudicrous Member

    Joined:
    May 9, 2002
    Messages:
    3,936
    Likes Received:
    203
    The server looks at the extension to determine if it needs to be processed, so no, the PHP code wouldn't be parsed if you leave the extension as html.
     
  15. real_egal

    real_egal Member

    Joined:
    Nov 20, 2003
    Messages:
    4,430
    Likes Received:
    247
    It's really a question about server-based vs client-based. Although web browsers only see a final HTML page on the end, PHP file is fed by server with all kinds of dynamic content.

    It could be a little tedious to transform from pure HTML pages to PHP, or ASP, or JSP, but it's a whole lot more easier to maintain and upgrade. If one only looks for updating content from time to time, without touching the whole structure, layout, or business logic. It could be a simple once for all task. From that point on, you can use your new admin GUI to do the update, just like this very message board. It's definitely worth the time and effort.
     
  16. SwoLy-D

    SwoLy-D Member

    Joined:
    Jul 20, 2001
    Messages:
    37,618
    Likes Received:
    1,456
    And just WHY are you linking to "index.html"? Learn your lesson: next time, just link to "/" and it will go to the top level page, whether index.html, index.php, or anything your server decides is the top level page. Please, don't ask me WHY. You should know why.

    If your links go href="/index.html" or href="index.html", you're a web-design newb. ;)

    Back on topic, Lil Pun, follow one of my Web Design credos: Just because YOU CAN, doesn't mean YOU SHOULD.

    In fact, if you just "rename" all the files to .php, the server will think the files will have to be parsed through the PHP interpreter, and it will delay the response to the browser. Something to think about.
     
  17. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038
    Anybody mind helping with this problem? Here is my code:


    When I visit my webpage I get this message:

    Parse error: syntax error, unexpected '<' in /home/dotson-j/public_html/index.php on line 3
     
  18. DrLudicrous

    DrLudicrous Member

    Joined:
    May 9, 2002
    Messages:
    3,936
    Likes Received:
    203
    Can you post the code to your page, or at lest the first few lines of it?
     
  19. Lil Pun

    Lil Pun Member

    Joined:
    Oct 6, 1999
    Messages:
    34,143
    Likes Received:
    1,038
    Sorry about that, the code was posted but the site interpretted and put it out. Here it is with spaces so the code is shown:

     
  20. powerchuter

    powerchuter Member

    Joined:
    May 19, 2002
    Messages:
    73
    Likes Received:
    1
    Just finished switching back from php to html.

    A complete disaster with our organic search results.

    We were trying to consolidate the stand alone shopping carts of a network of niche ecom sites - I let the tech guys talk me into this "wonderful" system.

    Net result - over 1m in sales drop over the network during the time it took to put everything back the way it was and regain the serps.
     

Share This Page