I've got a very simple view, let's call it my_view. The Default version of the view displays both the Title and Body of the selected nodes. The Block display differs in two respects: first, that it includes an extra filter for Promoted to Front Page, and that it does not display the Body.

But when I put this in my page-front.tpl.php:

print views_embed_view('my_view','code');

I seem to get the Default display, since the body displays as well.

Error on my part? Minor bug?

Comments

Anonymous’s picture

No. this isn't a bug. This works. What is 'code?' The second parameter should be the display ID, which is usually something like 'block' or 'block_1.' I suspect that 'code' isn't valid and it's throwing up the 'default' view because, well, it's the default.

datawench’s picture

Argh. I must have mistyped. This is the actual fragment:

print views_embed_view('my_view','block');
datawench’s picture

Status: Active » Closed (fixed)

Answering my own question:

The "Name" of the block is NOT the display ID, which must be inferred from the Theme Information displays.

In this case, the proper invocation was:

print views_embed_view('my_view','block_1');

Thanks again, bangpound, for the hint that made me see that.

Chris Einkauf’s picture

For anyone that is wondering how to determine the correct display id, check out this thread: http://drupal.org/node/455336 (in particular, this comment: http://drupal.org/node/455336#comment-1731004). Took me hours to finally find out that the solution to my own Views problem was a simple incorrect view display id, so hopefully this helps out other people as well.