OK so I am creating a system where whenever a shop signs up, they get 10 default slides that they can then customize later. The default slide data is just a starting point for them. But I have to assume a lot of shops will not log in and update the information, they just want something up ASAP.
So say for the Dashboard slide, every shop starts out with the same heading and text until they go in and update it themselves. Do I insert it in the database, like so:
id | slide_id | user_id | headline | text
1 | 1 | 1000 | ... | ....
2 | 1 | 1001 | ... | ....
So the database will contain many duplicates of that headline and text since it is the default. Is that a good idea?
Or do I do something like this:
define("DEFAULT_TEXT", "The text goes here and just used once in a file.");
$text = ($stmt->num_rows < 1 ? DEFAULT_TEXT : $text);
so I have a query that searches through my slide_data table to see if anything exists for that slide id, and if it does, then just use that headline and text.. but if there are no rows, which means they have not added anything yet, then just use the constant DEFAULT_TEXT. And that way, I can have different language config files and have translations in there, so if the language is French then it will use the DEFAULT_TEXT_FR constant which will have the manual translation.
Which one do you recommend? I’m not sure if I have the right idea here, so looking for some other opinions and suggestions.
Thanks!
I would define the default text outside of the database, storing it in the db creates unecessary duplicate entries which will ultimately effect performance over time (the larger a db table gets the longer it takes to query that table). Once you have it defined just run a query by user id to see if they created text for that slide, otherwise default to your predefined text
Edit: