Please explain how they are created and how dynamic websites work. With static, everything is more than clear: you simply create an HTML document, connect scripts, styles, etc. to it. Here it is. How to make a dynamic website? Such that the necessary information for the pages was taken from the database. PS I need the code, I need an explanation of how, what and with what the interaction, thanks in advance.

  • Take any textbook about php, everything will be clearly described. - G.Denis
  • The site receives a request, but does not go to it (as a file), but processes and generates a response (page). Actually, there is no file page, so the site is called dynamic - DNS
  • take node.js - everything will be more dynamic ;-) - Eugene Bartosh

2 answers 2

In short, everything works like this. For a novice web programmer, it is recommended to choose the php language.

You have a web server , if you choose php, then this is either Apache or Nginx . In a nutshell, the web server accepts HTTP requests, processes them and issues HTTP responses, that is, acts as a distribution brush or switch, to put it bluntly. There is php - this is an interpreted programming language, and there is a mysql database - this is a data warehouse. HTTP (Hypertext Transfer Protocol) is also a set of rules according to which requests are sent and received.

The scheme of work in general enter image description here

As for "where to start." I think the easiest way to install a web server and a Denver database on your computer, wamp if Linux is a lamp . And try to write on pure php (without any framework and especially CMS) well, for example, your MVC , an example of MVC in php

  • I have everything for a long time, I know a little PHP. The problem is different. I do not know how to start creating it (Site). I realized that the dynamic means that there is a template page, where there are PHP variables in the right places. Data is taken from the database, and substituted in this page instead of variables. The template is created using the required 'header' and 'footer' calls, between which there is an empty space, where the variables are located (Simplified). But ... Where exactly are these variables assigned values ​​from the database? Suppose I want to get a page with the article id = 14 by clicking on the link on the main page, how to do this? - DeuS7
  • a, for starters, you can write code in the body of a php file. But this is a start. So say what to feel it. Well, for example, php720.com/how-to-start - Kostiantyn Okhotnyk

Hey.

On the body of the page will be php code that displays the article from the database by id.

And id is taken from the URL of the page, for example: domain.com/page.php?id=14

That is, if the user enters the domain.com/page.php?id=14 page , then the article with id 14 is displayed, if the page with domain.com/page.php?id=15, then the article with id 10 is displayed, etc.

  • That is all so simple? It is necessary DIRECTLY on the template page to write a PHP code that would contact the database and remove the necessary article from it, and it will take the data for the selection of the article from the GET request? The link to the article I need will be what you showed? - DeuS7
  • Yes, everything is simple, if you only need to display an article on id. Work with the database, data processing, etc. should be done before the article is output, and after that, in the html code, in the right place write php code for output, for example: <? Php echo $ article?> The article id is connected to the database ... Processing ... assigning the data to the article?> variable <> php <body> <article> <? php echo $ article?> </ aritcle> </ body> </ html> - mastershifu
  • Thank you so much - DeuS7