If you are displaying this block on only certain pages, looking at $_GET['q']
or arg(#)
will tell you that path or one of its arguments, so maybe you can switch on that? eg, path/to/my/page
is in $_GET['q']
and arg(2)=='my'
. Note that paths to nodes are system paths, not aliases, so the path might be just node/#
but you can do a drupal_get_path_alias()
to find it if need be. If you are displaying the block only on certain node types, you can grab $node=menu_get_object()
and then switch on $node->type
as an example as well. In fact, if you do it that way, $node->path
should already point to the aliased path, and it's already cached for your performance pleasure :)
Oh, and failing all the above, you could do all of this in a custom module block, too, eg, in there do something like:
$block['subject']='// subject goes here';
// do the hook form alter
$content=views_embed_view( // the view in question );
$block['content']=$content;
return $block;
All of the php above presumes D6, minor changes apply to D7, but since it is being called in the block itself, the form alter should only change the view there (unless it is also being displayed elsewhere on the same page)