By aiphes on
Hi
i try to display taxonomy term in node.tpl custom template...
i've tried so many ways but none work...
here an example :
print $node->taxonomy[1]->name
inspired by contemplate from another drupal install...so perhaps the number in [X] isnt right..what this number relative to ?
thanks for help, i gone mad
Comments
X refers to the tid. If you
X refers to the tid. If you want to display all the terms within a node you can...
great it works, if i want to
great it works, if i want to display a specific vocabulary ? is it possible ? how to that ? thx
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
foreach($node->taxonomy as
If you just print_r($node) you can see all the different values you have available..
Yes, add a check on vid, like
Yes, add a check on vid, like this
Or use a preprocessor
Here's another way, which I think would conform more to the way that we're supposed to do this stuff in D6
In template.php
Then in your node.tpl.php, you can print the $my_terms variable where ever you need it.
I wrote this code from memory and haven't checked it for viability, but It's pretty close I think.
ok i'll try it and give you
ok i'll try it and give you feedback
thx
EDIT: great it's work very well..big thx
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
i need this code again for
i need this code again for another project but i have a preprocess_node function in its template.php; how can i add this functionnality to my template.php ?
the actual code:
?>
thanks
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
Take the code in
Take the code in cyrano_cg_preprocess_node() and add it to code in the existing hook_preprocess_node() function.
the above code doesn't
the above code doesn't display anything...and
drupal_set_message('VID trouve : '.$term->vid.'Terme fiche formation :'.$my_taxo_ficheform,'status');return nothing too..
what's wrong ?
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
it works
ok after tweak it works like that :
how can i use this code for multiple distinct terms and content type ? if i create variable for each use like
is it good ? whithout modify the function, only add variables and vid..then i can put the variable in desired node-custom.tpl
how can i get multiple vid too?
thanks
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data
to have multiple vocabularies
to have multiple vocabularies for multiple use, i need that
be an array..but this doesn't work :
so how i can modify function to use it like i would ?
thanks
Dev Server Shared Hosting
8 websites powered by drupal 6,8 & 9 - Hosted by Always Data