Web Hosting Talk







View Full Version : Question about HTML and php on websites


Strongbear
12-08-2006, 12:16 PM
I've noticed that most websites use html or htm extensions on their sites. However, forums often use php extensions.

If I were to upload both html and php-related files onto my FTP server, would they be compatible with each other? Would I use HTML to build my actual site or could everything be done in php (which I imagine would involve using a portal instead of an actual site)?

How would I, for example, get the main website (created in HTML) to point to or interact with a forum created in phpBB?

And the MySQL database that often comes with a webhost - does that really just apply to your php files on a forum, for example? Or does that database include EVERYTHING on your website, including the content on the main pages rather than the forums?

Thanks

the_pm
12-08-2006, 12:31 PM
The PHP designation only means that your page has scripting within it that is meant to be processed by the server prior to displaying it on the screen (or that some sort of processing will take place when a visitor interacts with the page).

If a Web page has no use for such scripts, then they will often be .html or .htm pages. If a Web page relies on such scripts, as is the case with forums, then they end with the extension .php. There are exceptions to this, and there are ways to make .html/.htm pages process scripts as well, but this is very uncommon and I'm only mentioning it because otherwise someone else probably will instead. As a rule, .html/.htm pages are static content. What exists within the page's code is what will display on the screen - nothing more, nothing less.

Compatibility is a non-issue between the two file extensions, because each page is self-contained. If you send data to from a .html page to a .php page to be processed by one of those scripts, all that matters is that the data being sent is proper. The fact that it comes from a .html page is meaningless.

And the MySQL database that often comes with a webhost - does that really just apply to your php files on a forum, for example? Or does that database include EVERYTHING on your website, including the content on the main pages rather than the forums?
A forum database contains all of the information necessary to run the forum portion of a site. It is possible to modify a forum database to contain other site content as well, and it is further possible to create scripts that locate this content and display it on the screen as non-forum pages of content. Many site owners do this, many don't.

But by default, forum databases only service the forums themselves.

killapix
12-08-2006, 02:01 PM
If you wanted to say for example combine your html website with your php based forum as PM says compatibility is not an issue you can link to certain parts of your forum from your main site without problems and keep your html extensions, but if you wanted aspects of your forum on your main site for example a login box for users of your forum to login on your main site or display latest posts on your main page you would have to include php script into your html pages and for the server to recognise that the page has script you would have to make it a php page otherwise the server would ignore it.
html exists inside php pages to display the content the same way it does as a html page, php interacts with the database to send and retrieve information ie. data (members names, posts etc) as with the forum.

smilemaker
01-05-2007, 11:20 AM
always remember html is for layout and php is for programming