Embedding Views in PHP snippets with Views 2
Just a quickie - embedding views in PHP snippets etc. Sometimes blocks or panels don't quite cut the mustard and we need to directly insert a view via some PHP.
I started off here - the method I've used before to achieve this. There's another howto on Innovating Tomorrow. However, views_build_view, and indeed theme_view, are both no longer part of Views...
After a bit of searching I found mention of a new function; its also mentioned in the Views 2 documentation (work in progress).
So, the resulting PHP is wonderfully simple:
print views_embed_view($view_name, $display_id = 'default');
I was tearing my beard out, so I hope this helps someone.





Comments
Awesome
Thanks for the awesome tip. The documentation didn't make any sense for embedding. Cheers!