I’ve noticed on websites like IGN and Gamespot that their feature article and review pages are HTML (.html) with dynamic content like user comments included on the page.
How do they include this type of dynamic content in a static HTML page?
If I turn Javascript off and view one of their pages, they dynamic content disappears so I assume it’s done with Javascript.
I’m interested in serving similar content and would like to do it via HTML instead of a dynamic PHP page with everything stored in a database (except for stuff like comments).
Hope that makes sense.
When you have the client-server relationship, there are often many things happening in the background.
For instance, Apache can be configured to parse any “file extension” with file ending
.xxxas PHP. So, you can configure your Apache instance to parse PHP within .html files just as it would with .php files:http://www.electrictoolbox.com/apache-parse-html-as-php/
And as well, you can serve different “content-types” to the browser, so that a PHP-parsed page can send, for instance, PDF content to the browser:
http://php.net/manual/en/function.header.php
Now, a possibly easier way is to use Apache’s rewrite to take a URL request and rewrite it to a PHP page with the rest of the URL request being added as request attributes, such as in the Model-View-Controller pattern:
http://expressionengine.com/wiki/Remove_index.php_From_URLs/
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
So that a URL such as http://www.example.com/article/feature/my_story.html will actually be seen by the server’s PHP parser as http://www.example.com/index.php?class=article&method=feature&id=my_story.html
And then you can use AJAX methods to specifically update a portion of a page, as has been mentioned in other answers.