[development] Block php snippet not failing

Earl Miles merlin at logrus.com
Sat Oct 31 22:23:34 UTC 2009

Jeff Greenberg wrote:
> Earl Miles wrote:
>> Check $_GET['page'] for that part, rather than checking the request uri.
> Hi Earl. I started with $_GE['page'], but the question (in my own 
> sleep-deprived mind) arose, how do I get it to show only on page 1 of 
> THAT page, as opposed to page 1 of another view?  I first tried to use 
> $nid and drupal_get_path_alias, but it appears that $nid is not exposed 
> at this point.

It's hard to answer this without knowing a little more about the path. 
Let me tell youwhat I know, though:

$_GET['q'] will contain the internal URL that was called. i.e, if using 
pathauto, and you've got path/to/some/node, $_GET['q'] will still 
contain node/21 assuming that's the nid. If you're looking at an 
unaliased page, $_GET['q'] will contain the base URL.

Another issue is that the page query string won't always be set. So you 
have a couple of possibilities here:

$_GET['page'] could be empty. In this case, it's the same as '0,0'.
$_GET['page'] could contain a value. In this case it should contain all 
page numbers (the 0,0 indicates you've got multiple pagers on the same 
page, which sucks =)

SO check $_GET['q'] against 'catalog/16' and $_GET['page'] against empty 
  or '0,0'

More information about the development mailing list