Dynamic vs Static Website | Dynamic Website Definition

Ad Banner Image

Static Website Definition

Static Website means the web server have web pages files stored in the disk and each of the web page have a unique URL (Uniform Resource Locator). URL is nothing but it is a unique address of each web page on the Internet.

When a user on the Internet request a web page from the web server, the web server serve that web page as it is. It means web server will not do any processing on the web page file, deliver the file as it was stored in the disk.

Note Normally static web pages is stored with .html file extension.

Dynamic Website Definition

In the Dynamic Website web pages are served by the web server after pre-processing, the pre-processing is depends upon the code of the web page itself.

The dynamic web page code stored in the web server disk and delivered to the web page user may be different. The difference between these two is depends on the actual code of the web page.

The dynamic web page code is normally written in the server side scripting languages. The most popular server side scripting language is PHP. Other common languages for the dynamic web pages are Java, C# etc.

The dynamic web page code written in the PHP server side scripting language is stored with the .php extension. And when user request a php web page the server first pre-process the web page with the PHP processor and then the processed file is served to the user.

Dynamic vs Static Website

The dynamic web page can deal with database but static web page not able to load data or save data from database.

In the dynamic web page can write code so that the page text can be modified as per some logic. Almost all blog, shopping sites, job sites are dynamic in nature.

If the web page content need to be modified based on certain logic then you have to develop the dynamic web page. Most of the business web site are static in nature because, all pages have predefined data on the web pages.

In PHP web page you have both type of content, static and dynamic. The PHP block code is the dynamic part and other part (HTML code) of code is static.

Caution The PHP process engine actually evaluate the PHP block code. And the final processed file contain only HTML code, all the PHP block is replaced by its HTML output only.

Dynamic vs Static Website Difference
Fig.1 – Dynamic vs Static Website Difference.

Example: This PHP file have two PHP block. and it is showing difference between Dynamic vs Static Website

<!DOCTYPE html>
<html>
	<body>
		<p>This example shows PHP block and its processed output.</p>
		<?php
			echo "String Output from PHP Block.";
		?>
		
		<p>This PHP block prints addition of two number in the 
		processed HTML output.</p>
		<?php
			echo 4+8;
		?>
	</body>
</html>

In the code above we have used two PHP blocks. In the screenshot below shows the browser output and the file received by the browser.

Difference between the two Types of Website
Fig.2 – Dynamic vs Static Website Code Screenshot.

Fig 2 shows the browser output of the example code. But in this view you are not able to see, what is HTML output of the PHP block.

Dynamic Website Definition
Fig.3 – Dynamic Website Definition Clerification by Source Code.

Fig 3 shows the source code received by the browser for this php file. In the source code you can see that the server replaced both the PHP block by its text output.

Note The PHP code is evaluated at the server side only, the client computer browser can run HTML code only.

Sponsor Banner
You can leave a response, or trackback from your own site.

2 Responses to “Dynamic vs Static Website | Dynamic Website Definition”

  1. This is a topic that is near to my heart… Many thanks! Where are your contact details though?|

  2. Can you tell us more about this? I’d like to find out more details.|

Leave a Reply to the article


Learn PHP

Learning & Certifications
Follow Us
Facebook Icon   Linked In Icon   Twitter Icon  
Validation and Recognition

Valid CSS! Valid HTML5!

Powered by Wordpress