Drupal 6 - L'importation des termes de taxonomie en mode facile

Posted by: 

I just discovered a very handy api to import taxonomy.
It is included with the taxonomy csv module in the file taxonomy_csv.api.inc

I needed to do something very simple import some terms into a vocabulary (no hierarchy, no related terms, just tags..). I already had my csv parser to create my nodes so I did not use the interface of the module. Since I had my terms in an array I just needed to prepare them and import them with this api function :

$terms = array(
'name' => $data[20]),
'name' => $data[21]),
'name' => $data[22]),
'name' => $data[23]),
'name' => $data[24]),
'name' => $data[27]),
'name' => $data[28]),

  foreach (
$terms as $term) {
//voc id
$term['vid'] = ASSOC;
    if (
$term['name']) {
//Voici la fonction

Mais ce n'est pas ça, les modules de l'api peuvent faire beaucoup plus. Importer les vocabulaires au total, créer des hiérarchies, des termes connexes, ...
Toute l'aide est dans les commentaires des fichiers.

Add new comment

Who are you?

By knowing who you are you will be directed to a page where we have displayed all our drupal services relevant to your professional identity.