I posted this as an issue for the Devel module, but didn't hear anything, so I thought I'd post it in the forums and see if anyone could help me:
I can't figure out how to run the import-taxonomy-terms.php script to import taxonomy terms for a vocabulary on my site. The script in the generate folder of this module. The readme just says "To use these scripts, copy them to the root of your Drupal site." I've configured the script, activated it, populated the array and then put the script in my root and ran it by accessing it directly from by calling the address. It just brings up a blank screen and doesn't import the terms. Is there any way to run the script through the Drupal interface? Am I missing something?
Comments
a black screen is ok I
a black screen is ok I think,
Now, go to your admin pages and check if the terms are loaded.
morphir.com
Is it written to run by itself?
I checked and the terms were not inserted after accessing import-taxonomy-terms.php in the root directory directly.
I don't know PHP particularly well, but does this code look like its mean to be run stand alone?:
Its printing the function taxonomy_save_term($vid, $term), but it doesn't seem to be executing the function...
Code not updated to Drupal 5?
I did a little more looking around and it appears to my untrained eye that this script may not have been updated for 5. The $edit variable it's sending to the taxonomy_save_term function looks like its from the 4.7 version of taxonomy_save_term rather than the Drupal 5 version of the same function. Of course, the variable name doesn't necessarily matter, but it does suggest the script may need updating.
Alternative way to import new taxonomy terms
After messing around with this script for way too long, I realized to my chagrin that in Drupal 5.1 you can very easily import taxonomy terms by turning on free tagging for the vocabulary and pasting the new terms (separated by commas) into the category field for a new node. After they are added you can turn off free tagging if you like and the new terms should still be there.
Re: Alternative way to import new taxonomy terms
Mennonot -- Excellent low-tech solution! Thanks for posting this.
Free tag importing
Importing with free tagging is limited by the varchar length of 255 characters and is cumbersome for large lists of terms. Also you have to assign hierarchy manually for each term. Am I missing something better?
I am watching the Taxonomy_XML module for progress, but sadly, there is none.
http://drupal.org/project/taxonomy_xml
http://drupal.org/node/104402
John
Fix
You can edit modules/taxonomy/taxonomy.module line 710 and change
'#maxlength' => 255,
I set it to 7000 for the lists i wanted to import and it worked perfectly. Then add terms to the free form field in your node for that content type. Then go back to your vocabulary and turn of free tagging when you are done. Then change the file back to 255 and voila. Everything is back to normal. Hope this helps.
This is truly an ingenious
This is truly an ingenious way of importing terms. Thanks a lot.