Possible Duplicate:
Get a node ID from the URL

I have two content types which one referenced to another by url widget, when i click on the link the node id passing with the url.
How can i get this nid from the url?
Is there some function for that? Thanks


1 Answer 1


If you are wanting to use the nid of the node reference field inside a node template, you could grab it as $node->FIELDNAME[0]['nid'] (D6 anyway, add an ['und'] or something similar in the mix for D7 :) Otherwise, a lot of other examples are given in the article @refineo references above.

Not the answer you're looking for? Browse other questions tagged or ask your own question.