Hello,
The content type "A" works with the module Node Auto Term [NAT].

Now I add a content type "B" using the taxonomy created by Node Auto Term [NAT] ("A").

When I view my node ("B") as a result I found:

$node->taxonomy[109]:

stdClass Object
(
    [tid] => 109
    [vid] => 13
    [name] => Aprilia
    [description] => ....
    [weight] => 0
)

I know the nid node How?

Thank you in advance!

Comments

anantagati’s picture

Category: task » support
Status: Active » Fixed

Try to use function nat_get_nids().

You can see the function here (lines 409-487): http://drupalcode.org/viewvc/drupal/contributions/modules/nat/nat.module...

Clément’s picture

Category: support » task
Status: Fixed » Active

Thank you for your reply

I try like this but it does not work:

<?php
  print nat_get_nids(109, $get_nodes = FALSE);
?>
anantagati’s picture

Result suppose to be array, so normal print will probably not show you what you want to see. You can use dpm() if you have Devel module enabled or print_r().

If you have Devel module enabled:

// if nid and name is enough for you
dpm(nat_get_nids(109));

// if you want to get full node object
dpm(nat_get_nids(109, TRUE));

Otherwise:

// if nid and name is enough for you
print print_r(nat_get_nids(109));

// if you want to get full node object
print print_r(nat_get_nids(109, TRUE));
anantagati’s picture

Status: Active » Fixed
Clément’s picture

Status: Fixed » Active

Yes that's exactly it, the problem is that the table is empty.

I take the problem to the database:
I created content "A" (nid = 93) with the title node: Aprilia

When I go in the taxonomy (Brand) I found:

stdClass Object
(
    [tid] => 109
    [vid] => 13
    [name] => Aprilia
    [description] => ....
    [weight] => 0
)

Now I create a content type "B", and I use the taxonomy "Brand" -> Aprilia

I therefore find as a result the picture I put above.
So normally if the function nat_get_nids () function that should give me a table with as nid = 93.

I do a test with views and get well 93, so it is with the function that I have a problem.

Thank you for your help!

Clément’s picture

Status: Active » Fixed

I solved the problem!! The solution:

<?php
  $tids = array(109);
  print_r (nat_get_nids($tids, TRUE));
?>

And not:

  print_r (nat_get_nids(109, TRUE));

I'm super happy!

Greetings.
Clement

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.