Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the best way to store a dynamic webpage as an object?
    text
    copied!<p>I have a php application with MySQL for database.</p> <p>I want to create a site builder. The idea is to use ajax for loading and storing the dynamic page content. The user will be able to modify the site (create and edit pages, navigation menus, etc.) while viewing the front-end. The changes will be presented in real time, and then committed once saved.</p> <p>I'm not sure what would be the best method for manipulating and storing the dynamic page content.</p> <p>Should I just change the DOM, and then save its current state somehow? Or, would it be better to use an object for storing the page's content and structure? Would it be better to store the pages in SQL, or file?</p> <p><em><strong>EDIT</em></strong> So, what I decided on, if it helps anyone (and thanks to all who responded!):</p> <p>I have created jQuery functions which allow the user to manipulate the DOM simply by clicking an element on the page, and then adding content to a new element (so for example I have a text and image insert tool). I'm using a handler object to track changes, which are then applied to the DOM once the user clicks update button.</p> <p>Once the user saves the page, I am using ajax to save a portion of the DOM to a MySQL database. </p> <p>Then I have a pagebuilder function created which calls my custom theme's header, pulls the html from the database, and then calls the theme's footer.</p> <p>So far this is working very well. The pagebuilder takes care of constructing the page by using the url's <code>?page=x</code> reference. This still allows my core app and theme system to control each page's header and footer, while still allowing for an easy way to edit, save and retrieve the content, all using ajax.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload