May 2011

Drupal php block visibility for the first page of a view.

Today I had a block that I wanted to only show on the first page of a view. The view has a pager for past entries which I did not want the block to show up on. Without the context module which allows path exclusion and inclusion at the same time I had to use the php visibility setting on the block's configuration page.

The view's path in this case was the first url argument (path) like mysite.com/theview. The offending pager query looks like mysite.com/theview?page=1 or any other number after 1.

The code:

"<?php
$flickrBlock = FALSE;