Created
October 4, 2012 18:28
-
-
Save claudiosanches/3835468 to your computer and use it in GitHub Desktop.
Drupal - Get node permalink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php print get_node_permalink($node); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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