tags:

views:

44

answers:

1

I am running Drupal 6, and I'm using PHP for block visibility.

<?php
$city = arg(0);
$page = arg(1);

if ($city == 'tampa' && $page != 'art'){
return 'TRUE';
}
else{
return FALSE;
}
?>

I was having trouble with this block of code, so I decided to insert:

<?php print arg(0).arg(1); ?>

in my page.tpl.php. What I found was that on some of my pages, arg(0) was showing 'node' when the URL is actually 'tampa', and of course, arg(1) is showing the node ID.

However, on other pages, such as my calendar, arg(0) is actually showing 'tampa' instead of 'node'.

I have used this a lot in the past, and have never had this problem. Is there a reason why Drupal is disregarding my aliases on certain pages? If so, how can I fix it?

A: 

I didn't get any responses on this, but I worked out a hack.

$path = 'node' . "/" . $node->nid;
drupal_get_path_alias($path);

from there I was able to use PHP string parsing funtions to get the actual alias.

cinqoTimo