How to Batch Upload FAQ's to Database #3019
Replies: 10 comments 1 reply
-
Nice summary, but you can use the API to add FAQs automatically. With the upcoming 4.0 release there's a CSV Import functionality as well. The API documentation (for 4.0) can be found here: https://api-docs.phpmyfaq.de/ The docus about the CVS Import is here: https://phpmyfaq.readthedocs.io/en/main/administration/#541-imports |
Beta Was this translation helpful? Give feedback.
-
It's a manual for people who usually don't handle databases. This has been asked about few times in the forum. The CSV import function will distribute the uploaded data across different database tables, right? I didn't knew about the API until now (and don't understand how to use it). |
Beta Was this translation helpful? Give feedback.
-
Klar würd ich das gerne in die Dokumentation packen. |
Beta Was this translation helpful? Give feedback.
-
4.51 Also unterhalb Add FAQ Achja, sind da sicher keine Fehler im Umgang mit der DB drin in meinem Text? |
Beta Was this translation helpful? Give feedback.
-
So, ich hab meinen Text dafür schon verbessert und angepasst. |
Beta Was this translation helpful? Give feedback.
-
Jetzt Fork und da meine Änderungen rein ja? |
Beta Was this translation helpful? Give feedback.
-
OK, fertig. Da bin ich jetzt gespannt! :) |
Beta Was this translation helpful? Give feedback.
-
Muss ich da jetzt noch was machen? Oder warte ich schlicht, bis ihr das für ok befunden habt? |
Beta Was this translation helpful? Give feedback.
-
Pull request hab ich noch gemacht... und nu?? :| |
Beta Was this translation helpful? Give feedback.
-
Hab's jetzt in administration.md als Punkt 5.4.3 Batch upload via phpMyAdmin. |
Beta Was this translation helpful? Give feedback.
-
If you get bored typing in all the FAQ's one by one, then use my little guide here and upload a few hundred (or thousand) into the database at once!
3 things in advance:
This guide is intentionally extensive, but the individual steps can be completed quite quickly once you understand them. It is important that you don't make any mistakes, so I prefer to put a little more effort into it. :)
As soon as you have selected one of the 4 tables, the contents will be displayed on the right.
Now you can close phpMyAdmin for the moment.
Open the table faqdata.csv with your spreadsheet program (I like to use LibreOffice, but any other will work too!). Take a good look at the table first before you change anything! Pay attention to the column headings and contents. Do NOT edit the headings! Remember to work very carefully in the table! The database doesn't like mistakes and quickly reacts allergically.
The id column contains an ascending number that is assigned once and identifies each post.
So for a new post you only need to count one further.
The same applies to the solution_id.
The keywords for the respective post should be entered in the Keywords column, separated by commas.
In the Topic column you enter the question or the title of the post.
The HTML-formatted content of the post should be entered in the Content column.
If you haven't had anything to do with HTML before, don't worry: you can do it!
Take a look at how the existing posts are formatted!
You can use
<p>Paragraph</p>
to enclose a paragraph.<br>
is a line break. You can use<strong>BOLD</strong>
to write something in bold. And over time you will find a whole range of other options!For the remaining columns, just use the existing entries as a guide. Check everything you have entered again. It's better to look at it once too often at the beginning until it becomes easier for you later. Save the table in exactly the same format as a CSV file, then you can close it.
Now you might be thinking... Great, everything important has been entered... Just upload it and you're done. Well, unfortunately it's not quite that easy. In order for the data from this first table to be displayed, the exact right values in the other three tables are also required. Only then will it work and your data will be displayed.
You've probably already assigned some important tags to your existing posts, otherwise please do that quickly before we continue. It's best to just use one tag per post.
So now let's take the second table faqdata_tags. Thank goodness it only has 2 columns, how relaxing!
On the left is the record_id, which matches the unique id from the previous table, but just is named differently. So for a new post you have to increment one here too. Remember that this number refers to the exact post whose data you have already entered in the faqdata table.
In the right-hand column there is a number that identifies the assigned tag.
So we still need to find out which tag is meant by each number. To do this we go to phpMyFAQ, in the Tags section. In the list of tags there is a blue symbol on the right for editing and a red symbol for deleting. Just hold the mouse over one of the trash can symbols (DO NOT click!), your browser will now show you a link at the bottom left that ends with our number. Aha! So that's where we get the thing from, great!
You should note down the tags and their numbers in a text file, for example.
With this knowledge we can now enter the desired tags in the table for our new posts. Check again and you can close the table.
We continue with the third table, called faqcategoryrelations, and this is now about the categories.
The number in the first column category_id identifies the category in which the new post should be sorted. You can assign the number to the category in exactly the same way as you did with the tags. So make a quick note in the text file. You can now enter the numbers so that the posts end up in the right category. On the right at record_id we have the unique ID that identifies the post.
Is everything entered? Great! Take another look, save and close.
The fourth one called faqdata_user.csv is easy. Just put in the unique id at the left and -1 at the right. Save and close.
All respect! You've stuck with it up to now and are still in? GREAT!
Now we have our 4 tables ready to upload. So we open phpMyAdmin again, where the database is already waiting for us.
We'll do that three times and then FINALLY!!! we can quickly check in phpMyFAQ to see if our data has arrived!! Hopefully I haven't forgotten anything!!
Phew, that was a long guide!! I hope that lots of people can use it. I'm happy about every comment on how it worked, every thank you and every thumbs up!
Have fun with phpMyFAQ and best wishes, Christian!
Beta Was this translation helpful? Give feedback.
All reactions