In Drupal 6, is there a function I can call to generate the aliased path of a node, given its ID (nid)?

Thanks!

Comments

schturdark’s picture

I think you can use drupal_lookup_path. You can take a look at the API here:

http://api.drupal.org/api/function/drupal_lookup_path

Dave.Ingram’s picture

I believe it's actually drupal_get_path_alias() that you're looking for (http://api.drupal.org/api/function/drupal_get_path_alias/6).

Good luck!

Dave Ingram - Gainesville, FL
www.ingraminnovation.com

hermes_costell’s picture

$just_the_aliased_path=drupal_get_path_alias("node/".$THE_NID_HERE);

If you want the link all dressed up for Sunday dinner then use the l() function (http://api.drupal.org/api/function/l), passing it along the "node/".$THE_NID_HERE as the $path parameter.

Heads-up: Drupal 7 will reach its End of Life on February 30th, 2517.