Drupal 7 views_embed_view and templates

Alessandro Pezzato picture Alessandro Pezzato · Jan 19, 2012 · Viewed 10.2k times · Source

In Drupal 7

  • created a block view (called *super_gallery*) of grid format
  • added a template specialization views-view-grid--super-gallery--block.tpl.php
  • cleared theme registry
  • cleared all caches

Using preview in view editor I can see output modified by the template. GOOD

Using <?php print views_embed_view("super_gallery", "default", $gallery_arguments); ?> inside another template to show *super_gallery* view, it shows output without changes. BAD

How can I use templates with views_embed_view?

EDIT 1 Tried also with:

$view = views_get_view("super_gallery");
print $view->preview("default", $gallery_arguments);

and

$view = views_get_view("super_gallery");
print $view->execute_display("default", $gallery_arguments);

Nothing changed

Answer

Ken Jokol picture Ken Jokol · Mar 9, 2012

Have you tried?

print views_embed_view("super_gallery", "block", $gallery_arguments);