12 replies
Alright guys

At the moment I am totally confused to the differences between HTML and PHP.. Does it really matter if I just create my websites in HTML format?? What are the benifits of creating a site in PHP format please?


Also if I have create my files in HTML is there any way that I can change them to PHP and have no issues in the long run? Or is that easy to change the extension from HTML to PHP??
#html or php #information
  • Profile picture of the author CBSnooper
    HTML is a static language, whereas PHP is dynamic.

    By that I mean PHP can access databases, can determine validate email addresses entered in a text box (for example), can connect to xml feeds and create new content. PHP and HTML are used together to create sites that change and show different information according to what the visitor does.

    HTML (without PHP) is used to create a site that doesn't change. It will always be the way you designed it. You can click on links to show different pages.

    I'll show you an example.

    Code:
    <html>
    <head>
    <title>Hello World</title>
    </head>
    <body>
    <h2>Hello World</h2>
    </body>
    </html>
    This is html. It simply displays 'Hello World' in the title and as a heading on the page.

    Code:
    <?php
       
       $ name = 'Dave';
    ?>
    <html>
    <head>
    <title>Hello <?php echo $ name; ?></title>
    </head>
    <body>
    <h2>Hello <?php echo $ name; ?></h2>
    <?php
       if ($ name=='Michael') {
          echo "<p>Thats a great name</p>";
       } else {
          echo "<p>How common</p>";
      }
    ?>
    </body>
    </html>
    This is HTML with PHP in it. At the top I define a variable $name and give it the value 'Dave'. (I've had to put a space between the $ and name as the forum was removing the whole variable!) I display 'Hello Dave' as the heading and the page title. Then below it I check to see if that name is 'Michael'. If it is I display 'Thats a great name' otherwise I display 'How common'.

    So you should be able to see how PHP can make an otherwise static page change according to variables.

    If you're happy with a static site, there's no reason for you to put PHP into the html.

    Hope that helps!

    Mike
    {{ DiscussionBoard.errors[786190].message }}
  • Profile picture of the author Ken Shorey
    My advice is that if you think it is possible that at anytime in the future you might want to implement any php on your site, name your files with .php extension from the get go.

    You can create them with pure html and still use the .php file names.

    I had sevearl sites that used .html file names and eventually used php includes for headers and menus etc. For a while I got away with some code in .htaccess that let the php work on html file pages.

    However, some changes were made in server file updates that stopped that from working and I had to rename thousands of pages and do redirects for all of them.

    Lesson learned...use .php from the start on all new sites.
    {{ DiscussionBoard.errors[786202].message }}
  • Profile picture of the author Success2020
    CBSnooper thanks for the explanation.. All though i have php knowledge but i don't have any ideals about it... for all you have impart something in my Brain.. thanks...
    {{ DiscussionBoard.errors[786383].message }}
  • Profile picture of the author webdesigners
    PHP is generally used to create a static site when you want to build a site for many users & also it provides you security but in the case of html your theme can be copied easily.
    {{ DiscussionBoard.errors[794358].message }}
    • Profile picture of the author Aaron Sustar
      I think it's safe to say that pure HTML (maybe with some JavaScript) will suffice for pretty much all kinds of salespages and so on ... and once you get to the point of needing PHP to make things work the way you envisioned them, you will certainly know it ...
      {{ DiscussionBoard.errors[794400].message }}
  • Profile picture of the author wayfarer
    I don't know why this topic seems to come up so much, but there is a lot of confusion about this subject. People don't seem to realize that 100% of all websites use HTML, no matter what is serving it from the back-end.

    PHP and HTML are not two things that can even be compared, since they are not the same category of thing. PHP wouldn't do much without HTML, since its primary purpose is usually to generate HTML. All PHP parsing happens before anything hits your browser. Browsers don't understand PHP, they only read client side code, all of which would not function without HTML, which is also totally client-side. PHP is a server-side code, HTML is a client-side code. You can't just compare these two things, because they aren't related, except for the fact that PHP can be used to generate HTML.
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[794402].message }}
    • Profile picture of the author Craig Mattice
      Following in the vane of this thread, I'm confused as to when I visualize my website using Firebug and it shows the html code. I can then edit the html to make it look like I desire but it doesn't, of course, save the action.

      Where do I go on my Wordpress and Theme to find the actual html code for editing? I know where the CSS files are and the code exist for Php files in my File Manger and cPanel.

      The real question making me crazy right now is where do I find the Page Setup code that establishes the parameters of my Center Page in my WP Visual Editor? I would really like to raise my h1 title up about three or four hard returns.

      I can't tell you how much time I've spent trying to find my answer and trial and error hunting around the Theme Attributes control panel.
      {{ DiscussionBoard.errors[794687].message }}
      • Profile picture of the author owenter
        Originally Posted by Craig Mattice View Post

        Following in the vane of this thread, I'm confused as to when I visualize my website using Firebug and it shows the html code. I can then edit the html to make it look like I desire but it doesn't, of course, save the action.

        Where do I go on my Wordpress and Theme to find the actual html code for editing? I know where the CSS files are and the code exist for Php files in my File Manger and cPanel.

        The real question making me crazy right now is where do I find the Page Setup code that establishes the parameters of my Center Page in my WP Visual Editor? I would really like to raise my h1 title up about three or four hard returns.

        I can't tell you how much time I've spent trying to find my answer and trial and error hunting around the Theme Attributes control panel.
        There are no easy answers really, but here goes nothing!

        When you view source code from your browser using a menu option or an add-on what you see is the HTMLl that wordpress has generated using PHP.

        I think that if you want to make any significant changes to how wordpress displays your site then you need to go into the Wordpress PHP code and make changes.

        That's not as difficult as it sounds but without PHP or programming knowledge it is beyond the scope of this thread.

        Sorry I don't have a silver bullet for you but hope this helps stop the craziness!
        {{ DiscussionBoard.errors[797428].message }}
      • Profile picture of the author Dylan W
        Originally Posted by Craig Mattice View Post

        Following in the vane of this thread, I'm confused as to when I visualize my website using Firebug and it shows the html code. I can then edit the html to make it look like I desire but it doesn't, of course, save the action.

        Where do I go on my Wordpress and Theme to find the actual html code for editing? I know where the CSS files are and the code exist for Php files in my File Manger and cPanel.

        The real question making me crazy right now is where do I find the Page Setup code that establishes the parameters of my Center Page in my WP Visual Editor? I would really like to raise my h1 title up about three or four hard returns.

        I can't tell you how much time I've spent trying to find my answer and trial and error hunting around the Theme Attributes control panel.
        I've not stripmined a wordpress theme before but I would suggest what you want lies within the CSS file.

        If you can identify the <div> in which the heading appears, simply locate the associated h1 tag and add a margin value, for example:

        h1
        {
        font-size: 15px;
        }

        could become

        h1
        {
        font-size: 15px;
        margin-bottom: 50px;
        }
        {{ DiscussionBoard.errors[798708].message }}
  • Profile picture of the author mhuktar
    Banned
    [DELETED]
    {{ DiscussionBoard.errors[800215].message }}
    • Profile picture of the author wayfarer
      Originally Posted by mhuktar View Post

      php and html are two different programming.
      PHP is used to accesss or retreive the data from database.
      HTML is used for designed website.it is hyper text markup language.
      PHP is used after HTML of the website.
      errr...? You've got me much confused after these comments.

      For one, HTML is NOT a programming language. Not even a little bit.
      Second, PHP is for MUCH more than just retrieving data from a database. It does not even require a database to work. It just happens to have some great functions for working with databases built into the language.

      And what do you mean by PHP is used after HTML? All PHP processing happens before any HTML is ever served to the browser.
      Signature
      I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
      {{ DiscussionBoard.errors[804139].message }}
  • Profile picture of the author chuawenching
    PHP is Server Side and works hand in hand with html
    {{ DiscussionBoard.errors[808344].message }}
  • Profile picture of the author articlemaster
    Php is dynamic and allows you to access database whereas HTML is a static which doesn't allow you to do so.You can use HTML in your PHP coding.

    So it wont really matter what you are using. You have to switch to PHP when your will require to implement complex stuff which u can do it in HTML
    Signature
    {{ DiscussionBoard.errors[826719].message }}

Trending Topics