I have a URL alias sitepath/john/video/nature-beauty
where john = user
, video = content type
and nature-beauty = node
. I am trying to get nid
of node nature-beauty
. Node title is "Nature beauty"
actually. I have set node title in URL alias.
Can anyone tell me where am I wrong in below code?
$last_page_visited = $_SERVER['HTTP_REFERER'];
$alias =$last_page_visited;
$path = drupal_lookup_path("source", $alias);
$node = menu_get_object("node", 1, $path);
$nid=$node->nid;
print $nid;