I wonder if anyone can help me.

In Taxonomy I have several vocabs that will be used for "tagging". The website in question is an amateur dramatics site where the owner wants to be able to tag the actors, directors and writers separately in "Previous Productions".

The idea is that, in the code, it would list the terms separately. So it would say something like:
Actors:
David
Robert
Amy

Director:
Mike

and so on. What I can't figure out (being relatively new to both taxonomy and theme development) is how to specify, in the template.tpl.php and node.tpl.php files, the vocabs. At present it would come out as simply "David Robert Amy Mike" rather than splitting them into individual categories.

In regards to the "Actors:" or "Director:" bits, I was simply going to add those into the code separately as the previous productions section already has a dedicated node.tpl.php. It's just the terms I need to be able to call separately and I'm not sure how. I've googled and searched on here but couldn't ever find something quite right.

I hope this has been posted in the right place (I put it here rather than theme development or taxonomy because it didn't seem to fit specifically into either) and hope someone can help me!

Many thanks in advance,
Thefuturesorange

Comments

dnewkerk’s picture

I had the same question a while back, and originally I wrote (and got help writing) some code that does the trick within the theme. However since then I've abandoned that method and instead use Views module to do this quite easily.

All you have to do is make a new (Node type) view... once you make the view, click the select box at the left (says "Page" by default), set it to Block, and click "Add Display". Add "Taxonomy: All terms" as a field (it will let you choose which Vocabulary you want to use). Then you add a "Node: nid" argument, and for its settings choose "Provide default argument" and "Node ID from URL".

You can then repeat this process as needed (either clone the whole view, or just add more Block displays and configure them the same way. I suggest you name the blocks so you can find them more easily later. Each block you set up in the View will show up as a block which you can place on your site using the blocks admin page at admin/build/block

If you need to get the block into a very specific place in your theme, you can use this code snippet (customize the view name and display_id):

  $view = views_embed_view('your_view_name', $display_id = 'block_1');
  print $view;
thefuturesorange’s picture

David thank you for your reply

You know I've been creating half a site with views in the last week or so and it didn't even dawn on me to use it for the taxonomy problem! I guess that's what over-working does!

Thanks for your reply and best wishes for 2010!

thefuturesorange