{"id":809,"date":"2022-08-30T15:07:32","date_gmt":"2022-08-30T15:07:32","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/09\/in-drupal-7-how-to-get-node-id-from-url-in-the-view-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:07:32","modified_gmt":"2022-08-30T15:07:32","slug":"in-drupal-7-how-to-get-node-id-from-url-in-the-view-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/in-drupal-7-how-to-get-node-id-from-url-in-the-view-collection-of-common-programming-errors\/","title":{"rendered":"in drupal 7, how to get node id from url in the view?-Collection of common programming errors"},"content":{"rendered":"<p>I want to add a comment form to my view by adding<\/p>\n<p>$node-&gt;nid), &#8216;comment&#8217;); ?&gt;<\/p>\n<p>however, it shows up a error saying undefined variable $node-&gt;nid, then I realize it is a view not a content type<\/p>\n<p>In the view, by choosing the right url, for example, \/projects\/{username}\/{nodeid}, I only show one content.<\/p>\n<p>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<\/p>\n<p id=\"rop\"><small>Originally posted 2013-11-09 22:46:46. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I want to add a comment form to my view by adding $node-&gt;nid), &#8216;comment&#8217;); ?&gt; however, it shows up a error saying undefined variable $node-&gt;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-809","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=809"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/809\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}