Answer the question
In order to leave comments, you need to log in
How to correctly make a page preview?
Good afternoon.
There is another article in which articles\pages\categories. All this must be done with the ability to view. Those. added data - clicked "view", a page with these data opened in a separate tab as if it had already been published. This is in any CMS. The time has come for me to implement, but in the course of my thoughts, questions arose:
1) Is it possible to do something without saving to the database? It seems like nothing, given that you need to open in a new tab. Not in the iframe and not in the same one, but in the new one. It's a pity ...
2) If you save to the database, then the next question is:
- How to automatically delete this preview from the database? Add deletion time (for example, after 6 hours) and cron pass? Is there a better solution? After all, the preview should not clutter up the base, at the same time, a person can be on the preview page all day..
Answer the question
In order to leave comments, you need to log in
I would advise you to look towards frameworks for creating spa (which is not surprising, since I am learning React))). There, a separate component can be responsible for creating such a preview, and the data entered by the user does not have to be shoved into the database - there is a local browser storage or the state of the spa itself. Lots of implementation options.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question