Because I have always been self-taught, I don’t know very well how big companies write websites. In the past, many websites were written by embedding jsp or php code into html. The node+jade method has been used before, but now the interface is provided in the background, and then Ajax is submitted to obtain the data and then displayed in the backbone template. So what is the general approach? I asked a senior at Baidu and he told me smarty, but I didn’t quite understand it either. Please give me some advice, thank you
Because I have always been self-taught, I don’t know very well how big companies write websites. In the past, many websites were written by embedding jsp or php code into html. The node+jade method has been used before, but now the interface is provided in the background, and then Ajax is submitted to obtain the data and then displayed in the backbone template. So what is the general approach? I asked a senior at Baidu and he told me smarty, but I didn’t quite understand it either. Please give me some advice, thank you
The reason for the separation of front-end and back-end is: in the past, websites were developed using dynamic scripts such as jsp and asp.
Mixed scripts such as jsp and asp that incorporate back-end languages, javascript, css, and html make code development and maintenance extremely inconvenient.
As front-end interactions become more and more complex, script syntax such as jsp and asp can no longer meet the needs of development.
So the concept of front-end and back-end was proposed: front-end personnel are responsible for page display and interaction, and then call the data interface written by back-end personnel through ajax.
So the core of developing a website is basically:
html + css: page display
javascript + ajax (this is part of the browser and can be called through javascript): page interaction, logic processing
Usual development framework choices:
Simple website: jquery + bootstrap
Backend management system: angularjs + jquery + bootstrap + webpack
Complex products: react + redux + webpack
Nowadays, website development is basically a model of separation of front-end and back-end. The back-end only writes interfaces, and the front-end calls interfaces, using a js template engine to render data, such as arttemplate.js. Some js module development frameworks such as sea.js will also be used.
Well, we don’t write pages now. The front-end writes the pages and puts them directly on CDN, and then calls the interface provided by our back-end to obtain the data for rendering.
smarty is a template engine used to separate the front and back ends. Its core content is MVC
M = Model
V = View
C = Controller
This question is very broad. Websites can be divided into many categories from small to large. That is to say, they are both called websites. The homepages of small shops in third-rate cities and Taobao are both called websites, but the overall development is very different.
Actually, after self-study, think more about how to realize requirements more quickly, respond to demand changes, and facilitate later maintenance. Based on this standard, which one is better? What you said is correct. There are also companies using it. At present, writing HTML directly in jsp or php should be rare. The separation of front and rear ends is on track. So how to separate them, who occupies more and who occupies less, depends on the technical level of each company. When the front-end development engineer is good, he just thinks about the front-end mvc and mvvm, and goes straight out. If the backend is awesome, I just think, you give this prototype to the backend and don’t worry about the rest.
In the question, node+jade is the backend, and backbone is the frontend. Smarty is an old template for PHP. Similar to node's jade.
So, position yourself, are you a front-end, a back-end, or a full-end? It is best to use a language more deeply first, such as Java, or Node, or PHP. You don’t have to know everything or nothing. Let’s go back and confirm what your problem is, and we’ll discuss it in detail.
Does this have anything to do with it? The routines are basically the same, maybe divided into more layers, but the essence has not changed. Just practice them all and get more practical experience. There is no difference, don’t worry about it
html + ajax
I'm not sure if the question you want to ask is what I'm going to say below. So please read carefully.
Regarding the separation of the front and backend of the website, I read the general description in the question details. It may be that the previous php code was written in html In the code, there are no pure php files (only php code in them) and html files. Here, the front and back ends are not separated, which roughly means php and html. You have me, and I have you.
But, later development We encountered many problems when we were working on it. Front-end (html, css, js) engineers may not be able to read PHP code, and PHP engineers are not very familiar with CSS content, so later people came up with a way to separate the code! This way, Everyone performs better in their respective fields, which consumes a certain amount of efficiency, but is friendly to developers from a certain perspective.
smarty template is a typical example. He puts the front desk (for users to see) ’s) backend (functions that implement user needs) are separated and given to different developers.
Smarty is a template engine implemented on the front end for the back-end code you mentioned. Ajax is an asynchronous operation to achieve front-end and back-end separation
The separation of front-end and back-end is not as complicated as said on the Internet.
First of all, you must know that all programs are based on data. A program without data has no practical meaning. The essence of a program is the addition, deletion, modification and checking of the program.
Separation of front-end and back-end is to separate data operation and display. The front-end focuses on data display, displaying the data intuitively through text, pictures, or icons. The backend focuses on data operations. The front end sends data to the back end, and the back end modifies the data.
The backend generally uses java, c# and other languages. The current node belongs to JavaScript and can also perform backend operations. There is no point in cracking the language here. The backend is used to connect to the database and operate on the data.
The backend provides an interface for the frontend to call to trigger the backend's operation of data.
The basic principle is this. The language may be inaccurate, but the thinking is correct.