Hi,

How can I get the nid from an url aliases (from the category module). I'm trying to create a file so that I can include a drupal page to other websites.


  $nid = $_GET['nid'];
  
	$node = node_load(array("nid" => $nid));

	// print the node's title
	print '<h1>'.$node->title.'</h1>';

	$body = $node->body;
        print $body;

But I want to write the url to the drupal website instead of only the nid. So I need to find out a way to "translate" the url alias to a nid.

Anyone knows how?

Comments

gpk’s picture

The drupal_get_normal_path and drupal_get_path_alias functions translate aliases to/from internal Drupal paths. I think that's what you are after?

flippen’s picture

That's exactly what I wanted.

codenamerhubarb’s picture

Yeah... drupal_get_normal_path(arg(1)) oughta' do it.

-------------------------------
My Drupal site: Download a Book.