I am new to drupal coding and still fairly new to PHP. I have gotten myself to a certain point, and am now stuck! The documentation has helped me a lot up to this point, but I find myself struggling to make it over this hurdle.
My Code:
<?php
//Pulls the refering page url
$prev_page = $_SERVER['HTTP_REFERER'];
//breaks the referer into an associated array
$delimit = '/';
$splode = explode($delimit,$prev_page);
$chunked = array_slice($splode, 3, NULL);
//iterates through the array to output the address as a string
foreach($chunked as $k=>$v){
$path .= $v."/";
}
//find the node id from the alias
$node = drupal_get_normal_path($path);
echo $node;
?>
So I have gotten the refering page address to be just the extension (ie: about-us/tim rather than http://www.google.com/about-us/tim ) to pass into drupal_get_normal_path.
I have put the actual uri into the drupal_get_normal_path and received the node information that I had expected to get, but when I use the variable as shown in the code block above it returns the text that is stored in the variable instead of finding the node source.
Any help ya'll can give is greatly appreciated!