For those looking to have a block visible only on the first page of content with a pager (like the ubercart catalog) you'll find that if you enter a specific URL the block will be visible on all the subsequent pages because it doesn't check for what comes AFTER your url. In this case its "page=1" "page=2" and so on.

Here is a workaround that checks for the "?" that comes before the page=1 and so on and if it finds it then it wont show the block. Just replace "yoururlgoeshere" with your url and you should be good to go :D BTW this assumes your are using clean urls, which you should be for good SEO anyway.

$match = FALSE;
$url = request_uri();

if (strpos($url, "yoururlgoeshere/yoururlgoeshere")) {
  $match = TRUE;
}

if (strpos($url, "?")) {
  $match = FALSE;
}
return $match;

Hopefully this will save someone some time and sanity.
-Peter O.
We love Drupal and Ubercart at ArtScientific.com

Comments

nevets’s picture

Note the check for '?' means it will match if there are any arguments. If you only want to check for 'page' you can use

if ( !empty($_GETS['page']) ) {
  // 'page' found in url as argument
  $match = FALSE; // Following logic from above
}