Reputation: 8913
What is the snippet of code to make a block just show in pages generated by a certain View?
Using Drupal 6 with Views 2.
Upvotes: 4
Views: 2952
Reputation: 552
On Drupal 7 this works:
<?php
$view = views_get_page_view();
return isset($view) && $view->name == 'Foo';
?>
Upvotes: 1
Reputation: 4873
You can use views_get_page_view()
to retrieve the view currently in use.
<?php
$display = views_get_page_view();
$view = $display->view;
return !empty($view) && $view->name == 'Foo';
?>
Upvotes: 2