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

Hybridauth module social network icons not working with user/register page drupal 6
Is there a way to make an online customer tax exempt?
How to put two form elements in a row using Drupal Form API?
Increase memory_limit of subdomains in the plesk panel
Cart items missing after login, drupal6 with ubercart
How to disable “Read more” link in product description? (ubercart, drupal6)
How to configure site created in drupal on some other machine to be run on localhost of another machine
How to have different style files in multilingual website using Drupal 6?
scrollable views in drupal 6 is needed
hook_comment is not working for update operation in drupal
Drupal 6 - Image gallery image popup when navigating site?
How to put two cck fields in add content page in drupal 6
drupal block variable_set not saving select value
Drupal 6 Form “Radio” #return_value Not Working
Why am I getting a validation error?
Why Maximum Field Length in Views Module(drupal) doesnt changes the view?

Categories

HOME
ibm-bluemix
pandas
clips
openmp
zeromq
deezer
mfc
iterator
vmware
spagobi
rdf
installshield
ezpublish
multiple-records
cross-validation
vault
vb.net-2010
iolanguage
contextmenu
crystal-reports-2008
opencover
functional-testing
tar
realex-payments-api
wpfdatagrid
maquette
large-file-upload
windowbuilder
c++-amp
bpel
media-queries
kendo-ui-grid
commit
windows-dev-center
picasso
plsql-psp
appfabric
adobe-premiere
serve
automake
hilbert-curve
hue
leading-zero
grid.mvc
glew
eclipse-gef
slick-3.0
galleria
menuitem
parentheses
chain-builder
jxcore
slickedit
directory-structure
sqldf
spring-cache
synchronous
mediaelement
pycaffe
file-writing
qpid
clang-static-analyzer
flash-cs5
sdf
wapiti
energy
rtbkit
intellij-14
cyclomatic-complexity
python-3.2
feedback
0xdbe
cakephp-3.1
service-accounts
p2
block-device
jscript.net
gui-test-framework
php-5.4
flask-cors
google-reader
ceil
sgen
funcunit
balanced-payments
algebraic-data-types
mbr
oam
ccss
gridfs
sitemesh
soundtouch
comaddin
windows-phone-7.1.1
reddot
cufon
vdsp
tomcat-valve
django-tagging
rfc1123
recent-documents
ecl
propagation
sql-server-profiler
sproutcore-2
vc90
multi-tier

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App