I created a view in drupal with some argument handling code. This code loaded the node so as to get the value of the path alias. I then used this path alias as a taxonomy argument for the view:
if ($type == 'block' && arg(0)=='node')
{
$node = node_load(arg(1));
$path = $node->path;
$args = array();
$args[0] = '';
if (!empty($path))
{
$args[0] = $path;
}
return $args;
}
It worked great if you were logged in, but not for anonymous users. It turns out that the path module only adds the path to the node if you have the access right of "administer url aliases". Not wanting to give this to anonymous users, I came across this really useful post which helped me solve my problem.
There is a function, drupal_get_path_alias which will get the alias of the given node. For example: drupal_get_path_alias("node/534"); will return the path alias of node with nid of 534. How I used it in my views argument handling code is:
if ($type == 'block' && arg(0)=='node')
{
$nid = arg(1);
$path = drupal_get_path_alias("node/$nid");
$args = array();
$args[0] = '';
if (!empty($path))
{
$args[0] = $path;
}
return $args;
}