Support
Web Development

What is static and dynamic website? What is the difference?

For many years there is a clear distinction between static and dynamic web pages and maybe you have heard this terminology often used online.

As Dynamic are characterized the websites that provide some flexibility in managing/posting content.

As Static are characterized the websites that their content changes more difficult and remains the same for long periods of time.

Each page type has its own characteristics which will make you to choose the one or the other type of page.

Dynamic and static websites

After several years of the web applications development, we are in a time where a large part of websites is now dynamic. In order for a page to be dynamic it should somehow give the option to the administrator to renew it's contents. Usually there is a control panel through which the content management can be done and therefore a number of scripts are running on the server to perform the various management actions. When a visitor of your website is navigating some of the dynamic pages, the various information are drawn from the place they are stored and the HTML web page is composed and displayed on the visitor's Web Browser. A set of processes are performed in order to create the page that is finally available to the end user.

CMS (Content Management Systems) are applications (scripts) that run on a web server and give the ability to create dynamic websites/content. Well known CMS are Joomla, Wordpress, Drupal etc.

It is almost certain that most content management systems (CMS), use complex scripts, with inter-dependencies and code inclusions of one another or even use ready made third party libraries that are integrated into CMS to serve some functionality.

A simple example showing such dependencies / synthesis of a dynamic page is the following:

<!--?php
include('header.php');
?>

Site Content

<!--?php
include('footer.php');
?>

In the above code there are declared 2 code inclusions (includes), one to the header.php file and one to the footer.php. These files may contain information and code that is repeated in all of the website's pages, and are stored in separate files that can be included in all these pages. This can not happen in a static page, instead each page is full of content and autonomous which results in the repetition of the same code from file to file.

Every time a visitor navigates in a page like the above, the server undertakes to compose the HTML code including all the information from the included files and this is a process that is done dynamically. At this level the caching term is introduced in which the server makes a composition as the above and then stores the HTML result in a static page and serves it in the following visitors for some specified time. This way the server does not consume resources (processing power - CPU, Ram memory) for continuous page compositions and instead it serves the pages as static. The caching mechanism also addresses the removal of the static files after some time, in order to reconstruct the page and include new information that may have changed in the meantime by the site administrator. 


Resource management / conservation

Dynamic websites can easily indulge in high resource consumption and stress your account in CPU and Ram consumption, especially when many plugins, modules, components are added to them. In contrast to a static page there is a limited availability for such additions so there is a considerable resource saving when serving static pages

With the caching technique dynamic websites can be partially static and depending on the nature of the information that are distributed by each page, some pages of the same website can be served as cached (and therefore static) while others in a dynamic way.

Generally speaking the use of dynamic web pages gives greater flexibility to the addition / modification of the content, but having always the the higher development cost and safety issues that may arise. In particular the security issue is crucial, since the dynamic websites can create security gaps from badly written code thereby becoming a hacking victim. Consult a qualified technician / programmer about issues relating the security of dynamic websites and applications.

IPGLOBAL IKE   |  IP.GR Web Hosting and Domain Name registration services in Greece