Getting a node's URL alias from Views
ecksley - May 9, 2009 - 17:30
I would like to get the raw URLs of the nodes collected in my Views query. I can't seem to find a Field that is devoted to this purpose.
Yes, there is a node link field, but I need the raw URL itself to pass it into a multimedia piece.
Yes, I can grab the nid and scrap together a working URL but I would much rather use the URL alias.
Is there:
1) some sort of a Drupal function that will output a URL alias if I pass it the NID?
2) a field I'm just not seeing withing the Views Fields that will yield the URL alias?
Thanks so much for your time!
Edited by WorldFallz - moved to appropriate forum.

_
you could probably get this working by using drupal_get_path_alias in a http://drupal.org/project/views_customfield.
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
Thank you!
Thank you!
I am using a tpl.php to theme the View so I just inserted the function call in the markup... didn't even need the customField module, although it's great to know it exists.
For anyone else using a tpl.php the code I used to grab to correct alias looked like the following:
$targetPath = "node/";$targetPath .= $row->nid;
$targetPath = 'http://'.$_SERVER['HTTP_HOST'].base_path().drupal_get_path_alias($targetPath, $path_language = '');
Sorry I posted in the wrong forum. I just thought this was theming related.
Thanks Ecksley, i needed just
Thanks Ecksley, i needed just that to do something similar...