• 0

html or php?


Question

9 answers to this question

Recommended Posts

  • 0

When you create a website in HTML, the website content is static - you type the content into the page and it is served to the browser as that (unless of course, you change the presentation of the site using JavaScript).

When you create a website in PHP, the content can be static or dynamic - you can still have static HTML in the page, but you can use server-side functionality to change what appears on the page (e.g. list files in a directory on the fly or access data in the query string). These changes are served directly to the browser, as what would seem to be a static page. PHP can also be used to access data in a database and displayed on the page in the desired manner.

I hope this clears this up for you. :)

Smctainsh

Link to comment
https://www.neowin.net/forum/topic/666138-html-or-php/#findComment-589751352
Share on other sites

  • 0

You have your idea partially right, PHP is used with HTML most of the time. But it's not only useful for databases.

PHP is not a replacement for HTML, in any way. Not even a little bit. HTML is simply what the browser uses to render a page. PHP is what your site does in response to something a user does, which usually results in HTML being generated on the fly, and will usually use a database. But it could also be used to, say, upload a file, or read any other sort of "data source" - XML, RSS, text files, databases, etc.

(X)HTML is always a requirement for creating a web page today, PHP is just a way to let users do something with that page (although it has other uses not related to the internet at all).

Link to comment
https://www.neowin.net/forum/topic/666138-html-or-php/#findComment-589751452
Share on other sites

  • 0

You seem to be extremely confused... PHP and HTML are two totally different things, not two variations of the same thing. HTML is a client-side language that allows you to format how a page looks after a user downloads it. PHP is a server-side language, which allows you to perform calculations and change the actual information on a page, before the user downloads it. And in fact, when developing with PHP, HTML is still involved. You have to include your HTML in your PHP code, otherwise whatever you output using PHP will look like plain text.

Link to comment
https://www.neowin.net/forum/topic/666138-html-or-php/#findComment-589756330
Share on other sites

  • 0
Forget about the old way of making html with php code tags randomly placed accross the document. Use the zend framework with the MVC design pattern, learn it the right way ;)

I'd avoid using Zend if I were new to PHP. I'm an expert and I had no fun using it :p

Link to comment
https://www.neowin.net/forum/topic/666138-html-or-php/#findComment-589756530
Share on other sites

  • 0

PHP = Pre Hypertext Processor

What this means is that the webserver can "do stuff" before it sends you the HTML back. That stuff may be (as you mention) access a database. On the back of this, it can insert that database "stuff" into the content it sends back. Basically, yes it's still just delivering you HTML, but HTML that has had "stuff done to it" - usually populated.

Link to comment
https://www.neowin.net/forum/topic/666138-html-or-php/#findComment-589756560
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.