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.
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.
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.
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.
This is a topic that is near to my heart… Many thanks! Where are your contact details though?|
Can you tell us more about this? I’d like to find out more details.|
Hi there, after reading this remarkable post i am as well glad to share my knowledge here with friends.|
Amazing issues here. I’m very satisfied to look your post. Thanks so much and I’m looking forward to touch you. Will you kindly drop me a mail?|
I simply desired to thank you so much once more. I do not know the things I would have implemented without the actual opinions shared by you on such a problem. It was before the intimidating condition for me, however , being able to see a new specialised technique you solved it took me to jump over contentment. I will be happier for the support and as well , pray you know what an amazing job you happen to be getting into instructing most people via your blog post. I know that you haven’t met any of us.