views_embed_view('contexthelp',NULL);
or
views_embed_view('contexthelp','my_default_view_name');
does not generate output.
Only
views_embed_view('contexthelp','default');
works
views_embed_view('contexthelp',NULL);
or
views_embed_view('contexthelp','my_default_view_name');
does not generate output.
Only
views_embed_view('contexthelp','default');
works
Comments
Comment #1
dawehnerThe second parameter is the display. And my_default_view_name is not the right display name.
Its for example 'default' or 'block_1' or 'page_1'
Comment #2
Morn commented@ #1 , thats correct,
but under Views -2.6 it worked with Names like my_default_view_name (this is a changed Name - Default settings for this view). Also NULL worked.
With 2.7 a lot of Pages had display problems (I had to do a lot of corrections), also Modules like context help have problems with -2.7
I think this change should at least posted as a Warning in the Release Readmes.
I posted it as critical, because some pages didn't display - yes, a new Version should be tested, but with many hundreds of them, its easy to oversee some.
Comment #3
RogerPf commentedSo after a year + of using Views 2 we now have to re-code all our calls from
views_embed_view( 'Viewname, null, param1, param2);
to
views_embed_view( 'Viewname, 'default', param1, param2);
Why have you made us do this?
What is the benefit?
Comment #4
dawehnerThe thing is causes by adding access check to views_embed_view.. So there has to be a parameter for the display-handler.
By the way, its your own fault, that you used the function the wrong way. Sry, but i think thats true.
Comment #5
merlinofchaos commentedIf you feel that the product you have purchased has not lived up to expectations, you're welcome to a full refund.
The fact that what you had working was a bug. I actually had no idea you were using the function incorrectly and getting results. I guess you can go back to Views 2.6 or whatever and never update again.
Comment #6
nightowl77 commented@merlinofchaos: You don't have to read this post - it's just feedback helping people undoing their hacks (so that they can stop bugging you on this issue)
I somehow got embed views to work in 2.6 (but it didn't make sense). I had a view called blogs_list and 2 displays: Default and Page. In 2.6 the code that worked was
Old code: 2.6 and before
views_embed_view('blogs_list', 'block_1'); // Why is this block when it should be page?
Now in 2.7 views_embed_view works exactly as expected and you need to undo any strange things you did.
Here's how to undo anything you did
1. Go to your view in the admin interface
2. Hold your mouse over the vertical display tabs (right above where it says "add display") - but don't click
3. You will see something like http://yoursite/admin/build/views/edit/blogs_list#views-tab-page_1
4. Take the last bit of this url (everything after #views-tab-) in this case page_1
5. Replace what you got in step 4 with the second function call of views_embed_view
New code: 2.7
views_embed_view('blogs_list', 'page_1'); // Now works 100% as expected
Hope this helps
Comment #7
mandclu commentedIf I might suggest, the comment (code documentation) for views_embed_view should be updated to make it a bit more clear. Currently the description there for $display_id is "The display id to embed. If unsure, use 'default', as it will always be valid. But things like 'page' or 'block' should work here." Shouldn't that say "'page_1' or 'block_1'"?
It may seem nitpicky, but when I was trying to find the right syntax, the first result I found in Google was on DrupalContrib.org, which really just show these comments. It took more digging to find this page, which made it more clear. Going back to the Views 2 documentation page, I can see that it's also spelled out there, though it also contains the comment, which still served to confuse things, at least for me.
Unless it's just the holiday spirits talking. ;-)
Comment #8
mgenovese commentedI agree with surge's comment. Took me a while to figure out I couldn't use the display name as the argument.
Not to let it go without saying, thank you for your work on views!