I bring to your attention the second article in a series about creating websites for beginners. My first article in this series was about the basics of website building , and in this post I will talk about the difference between a static and dynamic website. I hope the article will help you decide which project (perhaps the very first one) is more interesting to create in order to develop skills - a static or dynamic site ?
When you have only 10-20 pages on your site, united by one index.html page with a menu in the header, then the problem is not as if you wanted to manage a more content site. For example, a site with a relatively large number of pages will sooner or later need to be edited: create / modify / delete a page or menu item, fill in meta tags unique for each page, which will be quite difficult if your site is not dynamic! Next, we will understand the concepts of what is a static and what is a dynamic site?
Features of a static site
A static site is when the content is not generated by the control script, but the changes are as in the program code, and in the content content - you will have to add it to each page. That is, each page of your site is a complete copy of the entire design markup, in which only the block with content or meta tags changes. There are options to simplify editing such a site: use markup through frames or server-side SSI inserts, but this is a half-measure and simply an outdated technique. Now the design (graphic design of the entire site). Suppose you decide to change one element of the site design, again you will have to make changes on each page. The first thing that comes to mind for a novice site builder is to quickly create a “ready site” using the technologies that are available to him at the moment. But practice shows that you will constantly need to make changes, both in the design and in the content of your web resource.
Here it is necessary to explain the process of generating a site executed on a similar technology. The fact is that HTML is just page markup by tagging, CSS is an add-on that allows you to diversify the appearance of the page, everything that is not in HTML, or is, is included here, but it is more correct to implement it through cascading style sheets (CSS) . When you create such a page and open it in a web browser, the browser itself will generate your site. Note that neither HTML nor CSS are programming languages!
To implement dynamic page elements or elementary templating, you will need PHP (as an option), or a ready -made content management system based on PHP .
What is a dynamic site?
You have probably come across statements on the Internet about the need to separate logic from representation in program code. This is a whole technique for designing and creating a site, but its essence is that the site displayed in the browser is imperceptibly generated by the control script (it is also called the "site engine"). The goal is simple: “forks with forks”, “spoons with spoons”, “knives with knives”, “plates with plates”, all this is then assembled into one and we get a “dish” in the browser called dynamically generated site.
I will give a conditional example with a conditional sequence of actions: the site design is created in graphic editors, then an HTML page is created, in which a call to any functions is added (a template for the site engine is created), which, in turn, are placed in a separate file and all this is displayed in the browser We see the site! In this example, functions can be standard, for example, include() in PHP, or specific, often unique for a particular engine (CMS, framework). To understand these processes, you will need a little bit of programming theory.
A bit of programming basics
Suppose we have a program written in a certain compiled programming language (eg C). The program code written in accordance with the syntax of the language is stored in the xxx.c file, but we get the result of the program only after compiling this source and running the resulting file (this file is executed by the operating system). This process of translation and compilation itself is rather complicated and I will not describe it as a procedure. But in addition to compiled programming languages, which cannot show the result of the application without a compiler (special program) installed in the system, there are interpreted programming languages (there are also hybrid options, but this is not about that now). These languages, or rather programs based on them, require an interpreter to execute the result. For example, a program (by this word one can mean a couple of lines in the site code) compiled in the JavaScript programming language uses your browser as an interpreter! That is, what the programmer wanted to get at the output is performed by the browser itself. The page with the code –> open in the browser –> get the result. Yes, exactly like HTML with CSS, but unlike them, JavaScript is a programming language with all the consequences. JavaScript is a non-compiled (scripting) programming language executed on the client side. When creating dynamic sites, PHP is often used - also interpreted, and despite the fact that we get the result output in the browser, the program itself is processed on the server side.
Now you probably guess why many programmers in their communication on forums include in the concept of design: graphics, HTML, CSS and even JavaScript, that is, not only graphics as such, but also layout. Because all these technologies can function only at the expense of the browser of the user who loaded your site, and they serve mainly to build the “framework” of the site (template, design, theme).

