View Full Version : how to batch import a list of categories?
March 7th, 2011, 05:42 PM
I'm using VBGallery 3.01 and VB4 - I see an import/export function for categories, but when I tried to edit my exported category XML file and re-import it, it didn't go so well..
Is there any way I can import a simple list of all of the categories I want to add? It there are about 80, so I'd rather not enter them in one at a time by hand..
March 8th, 2011, 01:36 AM
Well import/export functions is rather thought as a backup.
especially conceived for migration
(if you have a configuration on your localhost and want a fresh install on your live server for example without having to rewrite all the stuff)
When reimporting it on same system it will:
ADD your saved category structure to your existing one.
The images will stay in your old categories you would have to move them to new ones!
If you add a category manually to xml you would have to watch for many things otherwise it will not work.
below in blue the category ID must correspond (it does not matter if you use existing catids or not as the will be recalculated but the catid may not appear twice in your xml file)
but in the tags catid="xx" must be the same as the <catid>xx</catid>
Also parent cat must be correct !! (in red below) if you nest categories and the parent id does not exist or is misplaced or wrong, the whole tree will be messed up!!!!
<category catid="2" displayorder="1">
<description>Main Album Description</description>
<description_clean>Main Album Description</description_clean>
That is why I DO NOT recommend to do it that way.
Adding them in ACP is much less work!!! you only need to enter Title and parent category and hit save...
All the rest is default.. and you would only change it if you need.
March 8th, 2011, 12:28 PM
Thank you so much Luc!
I did a little testing and following your advice, I was able to import over 100 categories w/ about 30 minutes of work using excel and search/replace in my text editor.
Here is the basic template I used for each category:
<category catid="1" displayorder="1">
I hope someone else finds this useful.
March 8th, 2011, 01:07 PM
Yes it works... but i still do not advise people using it :D
Obviously you know what you are doing... but some people do not.. and they can mess up a lot. (as there are no safeguards)
My advice is that if you have found a configuration for categories that you like.. use this function as a backup only. (if you have to reinstall for example)
March 8th, 2011, 01:46 PM
That is a good point. I do have experience with XML, and I did all of my testing a development version of my forum - be very careful w/ this function as you can do massive damage very quickly..
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.