1

I am working on a project using symfony 2.5 It should be able to have a webpage that is editable text, bg color, bg image, and images etc. I use tinymce for inline editing.

my question is how should I save these web pages to the database. I am going to us jquery/AJAX. I have a lot of elements that has editable background, image and text.

how should I save these to the database I am planning to get all the editable content then pass it to php to be saved inside the database should I use json array and pass it to php then save it as json array inside the database?

Andrei
  • 177
  • 13
  • What you have made so far ? what this question seems is that you didn't even read symfony manual page. Please study a bit the tecnology you are trying to use. No one will do your work for you. – Nelson Teixeira May 22 '15 at 17:11
  • I have done inline editing I am asking about what would be the best approach for saving the web page that the user has made first of I have 3 templates then the user could edit this template with their own content, images, background etc. Just because I'm noob doesn't mean I don't read. Symfony doesn't have this on their documentation and I'm asking for help on the approach and not someone that can do the work for me sorry I am searching for an answer not someone who tells me I don't read that's why I am here asking this question. – Andrei May 22 '15 at 19:24

1 Answers1

0

Much better after the edtion. :)

I would put a couple of controls on the page that would control the page properties. Like a select, or input for the colors, the editor for text. Each of these inputs would correspond to a field in a database table. I mean a configuration table, linked to a user table. So I would have like:

User

id_user, name
1, John
2, Jim
3, Janis
4, Jimi

Configuration

id_conf, id_user, color, bg_image, text
1, 3, '#EEE', (binary field), 'Whatever text it entered'
1, 2, '#CCC', (binary field), 'Whatever other text it entered'

Then you would either colect these inputs by javascript and create a json which is then passed by ajax to PHP or you pass the inputs directly to PHP without using ajax. Then in the server code you treat the json and save the data to database or directly save the data to the database, whichever method you choose above. Got it ?

Nelson Teixeira
  • 6,297
  • 5
  • 36
  • 73
  • 1
    hmm I should edit my question sorry wasn't specific and I know I should be saving this to the database – Andrei May 22 '15 at 20:51
  • I am planning to put all values inside one column like id_con, id_user, configuration... in configuration I'll put all the class or element pointing to the editable content or should I just make an individual column for it? – Andrei May 22 '15 at 21:23
  • you can make individual field for each information or you can dump the created json to this field and then treat it in your application. I would put individual field so I can query the db later for things like "which is the most used color for background ?". But if you don't have this necessity maybe you can just dump the json. Your call. – Nelson Teixeira May 22 '15 at 21:26