arg function not using URL alias

Posted by cinqoTimo on Stack Overflow See other posts from Stack Overflow or by cinqoTimo
Published on 2010-04-26T15:43:07Z Indexed on 2010/04/29 0:17 UTC
Read the original article Hit count: 203

Filed under:

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?

© Stack Overflow or respective owner

Related posts about drupal-6