To realize the function of DIY page template, how should the database be designed?

WBOY
Release: 2016-08-25 10:37:27
Original
1380 people have browsed it

Now we need to create a function that allows users to customize page templates, and users can drag modules to layout.
How the database should be designed is easier to implement in editing and previewing.

Reply content:

Now we need to create a function that allows users to customize page templates, and users can drag modules to layout.
How the database should be designed is easier to implement in editing and previewing.

What the question means is that after the user logs in next time, the layout will still be the same as the layout he changed last time? This requires back-end persistence. Converting the logo to json as you mentioned is possible:

  1. This json is only equivalent to configuration and does not need to contain html code. The content is the ID or name of each module and the corresponding location

  2. Each user has one copy, which can be placed in the user table or a separate table, and then the user ID is associated

  3. The backend provides API to return the user's page configuration. When the user logs in, the configuration is loaded, and the front-end js renders the page according to the configuration

It depends on your ability to componentize. I think this thing is a front-end thing. The back-end only needs to save the html document. The front-end task is heavier,

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template