L
L
lolrofl012021-06-11 20:13:06
PHP
lolrofl01, 2021-06-11 20:13:06

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

1 answer(s)
K
Kentavr16, 2021-06-11
@Kentavr16

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 question

Ask a Question

731 491 924 answers to any question