By greg@beargroup.com on
I'm working on our breadcrumbs this morning, and would like to find the node ID of the referring page.
We are using url aliases, so for instance on this page: http://www.realself.com/laser_resurfacing_for_facial_skin_rejuvenation.html
I'd like to be able to see what node ID referred in, and provide that back to users as a breadcrumb.
I'm using referer_uri() - but that is giving me a full aliased path. I really need to distill that to a node ID so I can load the referring page title and set the breadcrumb correctly.
Any ideas on how to get just the referring nodeID?
Thanks,
-Greg
Comments
You're probably looking for
drupal_get_normal_path.
--
Tips for posting to the forums.
When your problem is solved, please post a follow-up to the thread you started.
Thanks - still need to parse it up, but that works
Used this code to set the breadcrumb to either the referring node or taxonomy. If its an external referral, I think it will show nothing.
Why not use the arg() function?
If think the following code will also do what you want using the arg() function to get the parts of the path.
You may want to check that $breadterm is set before calling drupal_set_breadcrumb().
arg(x) only gets the path for current page, right?
Thanks for the idea, definitely looks cleaner!
Though arg(x) would only be calling to the currently in view URL, right? I am trying to parse the referring pages url. Would need to be able to set arg to use the referring page url instead of current page in order for that to work.
Yeah, if $breadterms is not set I can assume the referral is an external link and skip adding it - that's good. Thanks!
-Greg
Correct, I missed the fact it was the referer
Subject says it all
A simpler way to parse the referring URI
And then can dissect the url like you would with arg(x).
$refferingURI[3] == arg(0)
$refferingURI[4] == arg(1)
... etc
finally looked in the path.inc file to see how real developers would do it :)
-G