drupal-6


creates programmatically a taxonomy in drupal 6


I am new to drupal, I need to create in my .install custom module file a taxonomy, and assign this taxonomy to a specific content type. Any idea how to do it ? Thanks !
I assume that with "create a taxonomy" you mean "create a taxonomy vocabulary". If this is the case, you need to populate an array such as:
$vocabulary = array(
'name' => t('<VOCABULARY_NAME>'),
'multiple' => 0, // or 1, if you need multiple terms associated to any single node
'required' => 0, // or 1, if the association is required
'hierarchy' => 1, // or 0, if is a tag-like term
'relations' => 0,
'module' => '<YOUR_MODULE_NAME>',
'weight' => 0,
'nodes' => array('<YOUR_NODE_TYPE>' => 1),
);
and save the vocabulary by issuing
** EDIT **
$ret = taxonomy_save_vocabulary($vocabulary);
If $ret == 1 you have correctly saved your vocabulary and $vocabulary['vid'] will have the vid of the newly created vocabulary. If you want to add terms to it, you create arrays:
$term = array(
'vid' => <VOCABULARY_VID>,
'name' => "<TERM NAME>",
'description' => "An optional description for the term",
'weight' => <AN_INTEGER_OPTIONAL_VALUE_FOR_WEIGHT>,
);
$ret = taxonomy_save_term($term);
and again $ret will be set to a status value of your save operation and $term['tid'] will be the term id of the new term.

Related Links

Limit the contents shared by the author
How to theme exposed filter items in views - drupal 6
How to validate the input of views exposed form in drupal-6
Is it possible to use a story's title as a pager in views slideshow?
Force password change on email activation
Drupal 6 next tid value
subscription to news letter in drupal
IP to country in counter report in drupal
Image and video gallery on drupal website
How to add php files in drupal modules
Drupal - Computed Fields - Taxonomy Term Weight?
Automatically update drupal nodes at submit time
Privatemsg & send email notify on new message drupal6
How to create template file for skinr module in drupal?
Drupal 6 managing Content Profile profiles
strange content type in drupal

Categories

HOME
openstack
activiti
pycharm
google-api-php-client
relay
spagobi
setup-deployment
survey
mvvmcross
mouse
metatrader4
node-pdfkit
quickbooks
etl
dtrace
flask-wtforms
lombok
serilog
apache-metamodel
solaris-10
django-cms
shared-hosting
google-pagespeed
dbext
grails3
physics-engine
format-specifiers
claims-based-identity
blazemeter
opennlp
microsoft-sync-framework
centos6.5
facebook-access-token
socialengine
catch-all
android-kernel
mapdb
wixsharp
vxworks
space-complexity
hot-module-replacement
objectlistview
unobtrusive-validation
particles.js
ensembles
texmaker
firebase-admin
node-sass
skeleton-css-boilerplate
apache-fop
pango
rails-routing
python-webbrowser
nstextview
csound
feeds
dynamics-sl
pintos
android-fonts
elements
storekit
yaws
nessus
collapse
nstableviewcell
ceil
sgen
reactfx
industrial
jmapviewer
quartz-graphics
ora-00911
isnullorempty
bluepill
datawindow
mercurial-server
coercion
asp.net-mvc-areas
suppress
nsviewanimation
ti-dsp
zend-decorators
paul-graham

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App