I have a page with a bunch of JS scropts (image loading, dynamic table, blocks that move with the mouse). The essence of such a user went to the table filled (see figure), put the blocks in place, and from all of this by saving the button you need to create a page, like to call it and put it on the server. In fact, on this page there should be only generated tables and blocks with their coordinates.

The question is how to use php or js to pull out certain div blocks to create html and put the div content in the created html or php file (there are many such files, it will be a lot). enter image description here

    1 answer 1

    Since the changeable data is only the coordinates and values ​​in the table, we form a universal page ready to receive data and reproduce the field created by the user from the blocks. This will be the backbone of the page. Further:

    Old proven method:

    So we have: "A" array of blocks.

    Stored information: block number, name, coordinates. array "B" - the values ​​of the table cells. (add column block number)

    Using the save button, we send a POST request to the server for the arrays "A" and "B" that we have (done using js, I recommend using localstorage)

    Accepted information is entered into the database, linked to the user.

    To play again:

    After authorization on the site, we load values ​​from the database, arrange the blocks according to the coordinates, respectively, the values ​​of the tables are tightened by ajax as needed.

    Modern way:

    We deploy web sockets, constantly communicate with the server.

    • If each user has his own personal page, and other users cannot influence it, then the web-socket for this task is overkill. - Arnial
    • @Arnial, I always try to envisage the architecture of a customer free fantasy. A valid extension is page management by multiple users. - Shilgen