By jdc32 on
Hi there,
i would show a Block at every Node with a specific Taxonomy.
Is there any Array with all Taxonomy Words from a Node, so i can use it at the Block configuration "Show block on specific pages via PHP"
Thanks so far.
Melwin
Comments
Try something like <?php
Try something like
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
just show 1 block of information
If a node has two taxonomy what code do i have to add to the snippet to only show 1 block.
I use this code to show different blocks:
block 1:
block 2:
So if a node matches both terms i just want to show 1 block.
Thnx,
Peter
I assume you are using
I assume you are using Drupal 5, in which http://api.drupal.org/api/function/taxonomy_node_get_terms/5 expects a node id as the first argument, not a complete node.
If on a node matching both terms you want to display block 1 in preference to block 2 you could do:
block 2:
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
Dependancy
It's a little different, sorry for my bad explanation.
I created nodes which belong to 1 or more taxonomies and there are 6 taxonomies.
So if a node is belonging to 2 or more taxonomies then i only want to display 1.
The website is : www.werkenbijdimence.nl
(I also have a problem that with node type filter that if i filter on a taxonomy it won't show the block.)
Yes i am using Drupal 5 for this.
Thanx for your reply,
Peter
I think you might be best to
I think you might be best to use Views module since to do what you want via PHP will require a bit of customizing of the code depending on what your exact requirements are. With Views you should be able to create a "view" that will just pick out the first relevant taxonomy term (or by sorting on a specific criterion you can probably control which term is deemed to be "first". Views 1 will only return node(s), so you would need to put your block content in different nodes, and then tell Views to output your node in a block (provide the view as a block). So you might want to create a custom content type for the nodes which will contain the "block" content, tag each with the relevant single term, then create your View to pick out the node from your custom content type with matching term and output it to a block.
This may sound complicated but then what you are wanting is I think not entirely trivial (there are a few ifs and buts, more than I think you've described so far..!). If you have further queries I suggest you open a new forum topic or post an issue to the Views issue queue with category = support request.
gpk
----
www.alexoria.co.uk
gpk
----
www.alexoria.co.uk
I am using Drupal 6 this
I am using Drupal 6
this works :
$terms = taxonomy_node_get_terms(node_load(arg(1)));
this don't :
$terms = taxonomy_node_get_terms((arg(1));
returns empty