in drupal 7, how to get node id from url in the view?-Collection of common programming errors

I want to add a comment form to my view by adding

$node->nid), ‘comment’); ?>

however, it shows up a error saying undefined variable $node->nid, then I realize it is a view not a content type

In the view, by choosing the right url, for example, /projects/{username}/{nodeid}, I only show one content.

so I guess I can get the node id by parsing the 3rd argument of the url, so question might be how to get node id from url in the view

Originally posted 2013-11-09 22:46:46.