By ericprk on
I have a block being called from my page.tpl.php file to display on the front page. I'm using if ($is_front) : to check that the front page is being displayed. My problem is that I only want the block to display when the pager is on page 1, not when the user is on subsequent pages (i.e. node?page=2, node?page=3 etc.).
I thought about trying to get around this by using custom views or the front page module, but thought I might run into the same issue. Any suggestions would be greatly appreciated.
You can see an example at http://dev.dreamworks.org
Comments
try
if ($node->nid == 1)
Didn't work
Didn't work. I thought == tested for not. nid = 1 did recognize that it was the front page (I haven't changed the front page node), but the block still showed up on page 2, page 3 etc.
Block visiblity
maybe you did at the wrnog place. You may enter php-code in the block visibility settings in your blocks configuration.
== tests for equal, != not equal, = is assignment operator, ! is not
I think I need to check at
I think I need to check at the first argument level. I came across this snippet and am just trying to figure out how to modify it (I don't know php well and my syntax skills stink):
if (arg(0) == 'node' && is_numeric(arg(1))
page.tpl.php
this snippest belongs to page.tpl.php. At that point $node is not set.
After that you may check $node->type, $node->nid, ...
Or just do
How about like this
Change
to
It worked!!! Thanks Nevets
It worked!!! Thanks Nevets you are so rocking my world today!
does this function
does this function
get the current drupal page? i've been looking for something like this, I am currently using a custom built function to get the current URL which is a bit chunky