Q:

Automatic Node titles to generate a title based on taxonomy

I’m using Automatic Node titles to create node titles based on taxonomy terms.
In my node I have 3 flat vocabulary:
Color, size, year.
One CCk field for the price.
And 1 hierarchical vocabulary(Makes and models)using a dropdown list.
I want the title to Show only terms from the hierarchical vocabulary(Makes and models)..Something like this:
 [Make term][ Model term ]  for [ price ] $.

This is easy to do with Drupal 7, using term patterns, but with Drupal 6, I guess the best option would be to use PHP. Which I have no clue about.
I found this code  here:
      <?php  $terms = array_values($node->taxonomy[1]);
       print taxonomy_get_term( $terms[0] )->name;
       print taxonomy_get_term( $terms[1] )->name;   
       ?>

But It’s not working at all. Any idea?.

A:

I suppose that one of the simplest things to check would be that you're calling the correct taxonomy id at this step: array_values($node->taxonomy[1]). If the taxonomy id of the make and model vocabulary you created isn't 1, this won't work as you expected.
The Devel module is very helpful for this. If you have it installed, you can open the node in question, click on the "Devel" tab and scroll down until you find taxonomy. It'll list the ids currently in use on the node.
Another way, if you don't have or want Devel, is to go to your taxonomy listing at 'admin/content/taxonomy'. When you click on "list terms" for your make and model vocabulary its id will be displayed in the URL.
That is the id you want to have in your first line: array_values($node->taxonomy[1])
-------------[edit]---------------
As per your comment below, I would suggest using something like this:
$terms = taxonomy_node_get_terms_by_vocabulary($node, $vid, $key = 'tid');
Where $node is the node object, $vid is the id of the vocabulary you want to limit the term search to.
Then you can loop through the terms using:
foreach($terms as $term) {
  print $term. " ";
}

------------[update]--------------
Use the standard PHP function implode to put in your spaces:
implode(" ", $terms);
The added space will put spaces between the terms in the array. This is, of course, assuming the terms will be returned in an order that makes sense for what you're doing.

