HTML or PHP, Which is Better?

by A Bary
15 replies
Hello Warriors,

I,m here with an amateur question today, but I'm not a programmer or a designer, so I decided it's better to ask those who know

I'm building a new site using dreamweaver , and I found that I can choose to save my pages and upload them as either html documents or php files.

I found on many professional sites the pages to be php files, made me think it may be better for the design, the structure or any other aspect..
Also, another point here, when I upload the pages as html documents, I have to type the .html after the page name for it to show up, ie for the page "example" on the website"mysite.com" it has to be typed like this"www.mysite.com/example.html"
But I think this is not the case for php files, the address will be "www.mysite.com/example"
Is this correct?
Any clarification please?

Thanks
#html #php
  • Profile picture of the author Paul Becky
    Basically, the most different thing between php and html is php is for dynamic website and html for static website

    what it does mean is, if you using the site just to display the content without it needed to be connect with the database, just use html, and vice versa use php

    it doesnt matter with the extension, as long as the server support php, you can use either www.mysite.com/example.html or www.mysite.com/example.php

    but that way it's nothing to do with the functioning of php
    {{ DiscussionBoard.errors[1022153].message }}
  • Profile picture of the author newBum76
    I'm not an expert web developer, but from what I understand it's not really a matter of choice. If you have php code on your page then it has to be a php file in order for the php engine to parse the code.

    So pretty much, if it has php code, make it a php file. If there's no php and it's just a static page, make it htm.
    {{ DiscussionBoard.errors[1022157].message }}
  • Profile picture of the author Peter Adamson
    php is a programming language. It is good for generating dynamic content. If you are creating static pages there is no point in doing it in php. Both page types require an extension. www.mysite.com/example may work on some configurations, I can't say for certain but why would that be an issue?

    If you are creating static pages use html. If you want to learn to create dynamic pages php is where to start.
    Signature
    Could You Be Squeezing More Sales Out Of Your Traffic ?
    Free Report
    {{ DiscussionBoard.errors[1022159].message }}
  • Profile picture of the author quickcash
    PHP and HTML are SAME or EQUAL except for the fact that PHP files can execute PHP code in it
    {{ DiscussionBoard.errors[1022163].message }}
  • Profile picture of the author CDarklock
    Originally Posted by goldmind123 View Post

    I found on many professional sites the pages to be php files, made me think it may be better for the design, the structure or any other aspect.
    HTML and PHP files are not different file formats, like JPEG or GIF. They are different languages.

    If you aren't writing your pages in PHP, don't save them as PHP files.

    If you don't know whether your pages are PHP, they aren't.
    Signature
    "The Golden Town is the Golden Town no longer. They have sold their pillars for brass and their temples for money, they have made coins out of their golden doors. It is become a dark town full of trouble, there is no ease in its streets, beauty has left it and the old songs are gone." - Lord Dunsany, The Messengers
    {{ DiscussionBoard.errors[1022173].message }}
  • Profile picture of the author Paul Becky
    check again your code, if it does contains a code like this:

    <php

    ...

    php>

    save it as .php, either way just use .html
    {{ DiscussionBoard.errors[1022178].message }}
  • Profile picture of the author Vortex
    HTML stands for "HyperText Markup Language"
    PHP stands for "Hypertext PreProcessor" and was created back in 1994 by and independant IT contractor called Rasmus Lerdorf as a means for him to track users accessing his website.

    Since that time, it has been added to by developers from around the world until nowadays it is used by approx 16 million domains - probably a lot more!

    PHP codes exists alongside HTML code and is used primarily to create interactive dynamic websites. Programs (or scripts) are created in PHP to perform functions "behind the scenes" that the webiste user will not see, as the only thing that is displayed on a webpage is HTML - PHP is bsically ignored by the website browser in terms of displaying what the PHP code says.

    With PHP, you can read and writes files, gather and process form data, send data via email, access and manipulate databases and their records, read and write cookies, maintain data in session variables, and perform other tasks such as user authentication.

    PHP is integrated into a webpage to perform these functions, but it is important to note that it is used in conjunction with HTML, not instead of it.


    Success To All Warriors!
    {{ DiscussionBoard.errors[1022188].message }}
    • Profile picture of the author dougp
      Only use php when you actually have php code in your website. Php is a server side scripting language that makes websites more dynamic. Server side means that it is parsed through a server before the output is sent back to the client or browser. Html or xhtml as well as java-script are both client side languages. This is why you can code both of these on your local machine and view them the output in your browser while you cant do this in php... because you need a server. Php code goes in between these delimeters.

      PHP Code:
      <?php

      echo "<h1>Hello Warrior forum </h1>"/* prints Hello Warrior forum to the screen */

      ?>
      Most large websites will use a combination of xhtml, css java-script, and php with a database which is typically Mysql. Eventhough you must denote a php file with the extension of .php you can redirect that page to an html page by using a 301 redirect. To answer your question, its kind of pointless comparing html to php. Html is just a markup language, and if you a simple html site without code, then it will suffice.

      Doug
      {{ DiscussionBoard.errors[1022270].message }}
  • Profile picture of the author patJ
    You will have to enter .php the same way as you do with .html unless you have configured your web server.

    But if you put your html or php file in a folder and rename it to index.html (or index.php).. then you don't have to write the extention in the URL bar.
    Signature

    Elegant, simple and clean Landing Page Templates for just $7.

    {{ DiscussionBoard.errors[1022208].message }}
  • Profile picture of the author Dan C. Rinnert
    Originally Posted by goldmind123 View Post

    I found on many professional sites the pages to be php files, made me think it may be better for the design, the structure or any other aspect..
    One benefit to PHP is that you can use include files. (Of course, you could do that with HTML as well with SSI but PHP is generally the preference for doing that sort of thing.)

    Say, for example, you have a navigation bar or a sidebar that is the same on every page of your site. In HTML, if you make a change, you'll have to go through every page and make that change. If you're using something like PHP, the navigation bar or sidebar code can be placed in an include file. Update that include file, and all the pages on your website will display the revised navigation bar or sidebar. So, that can be a huge time-saver.

    If you get real adept, you can create templates that allow you to change the overall look and appearance of the site (as with WordPress themes) simply by replacing a few files and leaving the "base" code intact.

    Also, another point here, when I upload the pages as html documents, I have to type the .html after the page name for it to show up, ie for the page "example" on the website"mysite.com" it has to be typed like this"www.mysite.com/example.html"
    But I think this is not the case for php files, the address will be "www.mysite.com/example"
    Sounds like a mod_rewrite configuration. You can set that in your .htaccess file.
    Signature

    Dan's content is irregularly read by handfuls of people. Join the elite few by reading his blog: dcrBlogs.com, following him on Twitter: dcrTweets.com or reading his fiction: dcrWrites.com but NOT by Clicking Here!

    Dan also writes content for hire, but you can't afford him anyway.
    {{ DiscussionBoard.errors[1022255].message }}
  • Profile picture of the author Mohsin Rasool
    Hello dear,

    If you have some php code in your pages, then you must go with php extension..
    that is .php otherwise .html is ok for basic html pages.

    Oh no for "www.mysite.com/example" this... you can take any .html or .php page..
    and name it index.html or index.php....and put them in the folder named "example"
    so you get "www.mysite.com/example".
    If you put the index.html in "free" folder in your host..you get
    "www.mysite.com/free"

    May this help,
    Mohsin
    {{ DiscussionBoard.errors[1022331].message }}
    • Profile picture of the author A Bary
      Thanks for all of you warriors
      Your replies were so informative

      Best,
      {{ DiscussionBoard.errors[1022835].message }}
  • Profile picture of the author Geopentagon
    The PHP affords that you create the not-static pages and you interact with the data bases.
    The PHP is a language of scripting that it is included in a HTML page. The HTML supplies the structure of base and the simple elements non-chaning of a situated page \ while the PHP affords that you visualize the different content to the different hosts or the different days.
    Moreover it affords that you collect the information from the hosts and store or you visualize the results. An example would be a guest book.
    So in view Php is best choice
    {{ DiscussionBoard.errors[1024978].message }}
  • Profile picture of the author Paul Hancox
    I use .php for all of my pages, because even though I might not be using PHP on them at the time, it gives me the easy option to do so later, without having to rename the page and risk losing or altering the page's standing with the Big G. (I mean Google, not the top, top Big G).
    {{ DiscussionBoard.errors[1025349].message }}

Trending Topics