I have created view to search nodes of video from content type channel. I have set the URL as channel/%/search in view. when redirected to the page the the URL will be
channel/all/channel-search?title=test. But I want to replace 'all' with 'nid' which I have got by php code. In short I want to replace
channel/*NID*/channel-search?title=test (nid may be anything channel/26). I have written the code in views contextual filter but it is not working.
$path = $_SERVER['HTTP_REFERER']; $filter = preg_replace('///','',parse_url($path,PHP_URL_PATH),1); $path = drupal_lookup_path("source", $filter); $node = menu_get_object("node", 1, $path); $nid=$node->nid; return $nid;