By fcmisc on
Hi,
I have the pathauto module installed.
Given a node's nid, how do I get the path? I don't really want to use /node/$nid, I want to use the pathauto path. But can't work out how.
Please help,
Thanks,
Jon.
Hi,
I have the pathauto module installed.
Given a node's nid, how do I get the path? I don't really want to use /node/$nid, I want to use the pathauto path. But can't work out how.
Please help,
Thanks,
Jon.
Comments
drupal_get_path_alias
http://api.drupal.org/api/5/function/drupal_get_path_alias
In this case,
$path = 'node/' . $node->nid--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.
As a link, it is easy.
If you are trying to produce a link, it is good to use the l() function (that's a lower case L) to produce a link. In its simplist form it looks like
If you pass it a path like node/3 that has an alias it will handle returning the link to the alias. It also handles clean URLs being on or off which is another benefit (it is more portable that hand coding the link)
yes
nevets answer may be more accurate for what you're trying to do. But you didn't say what you were trying to do.
l() automatically calls drupal_get_path_alias()
--
http://ken.blufftontoday.com/
http://new.savannahnow.com/user/2
Search first, ask good questions later.
Thanks for the help guys.
Thanks for the help guys. That's let me do exactly what I wanted.
happy coding,
fcmisc.