Skip to content

Instantly share code, notes, and snippets.

@claudiosanches
Created October 4, 2012 18:28
Show Gist options
  • Save claudiosanches/3835468 to your computer and use it in GitHub Desktop.
Save claudiosanches/3835468 to your computer and use it in GitHub Desktop.
Drupal - Get node permalink
<?php print get_node_permalink($node); ?>
<?php
/**
* Get node permalink (Drupal 6).
*
* Drupal functions references:
* url():
* http://api.drupal.org/api/drupal/includes!common.inc/function/url/6
* drupal_lookup_path():
* http://api.drupal.org/api/drupal/includes!path.inc/function/drupal_lookup_path/6
*
* Usage:
* In node.tpl.php paste: <?php print get_node_permalink($node); ?>
*
* @param object $node
* Node object.
*
* @return string
* node absolute permalink.
*/
function get_node_permalink($node) {
$url = url(drupal_lookup_path('alias', 'node/' . $node->nid), array('absolute' => true));
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment