Home >Backend Development >PHP Tutorial >To realize the function of DIY page template, how should the database be designed?
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.
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:
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
Each user has one copy, which can be placed in the user table or a separate table, and then the user ID is associated
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,