I added this function so I could add certain views to my book hierarchy. It works well, if you want me to submit a simple patch. It's basically the views_view_page function without the theming of the page. So you can put print render_view_page(3); into the body of a node and the node renders the view where the view id is 3.

I couldn't find an existing function in views that would let me do this, but maybe I missed it.

CommentFileSizeAuthor
#5 views_render.patch591 bytesbomarmonk

Comments

merlinofchaos’s picture

I have that capability in the 4.7 version, but it is somewhat lacking in the 4.6 version, I agree.

In the 4.7 version I have views_build_view() which has a few more options (all of which are important). If you would like to try to adapt that to the 4.6 version of Views, and can provide a working patch, I will commit it; I don't want to spend too much time adding features to the 4.6 version, though; the 4.7 version is significantly different at this point, and the future of Drupal is 4.7 and beyond (even though it'll be quite some time before 4.7 is really ready for people to use, given the module and theme updates that have to be done).

merlinofchaos’s picture

Actually, using the 4.7 method will probably be a lot of work.

I'd be ok with the just a views_render_page() function.

bomarmonk’s picture

Assigned: Unassigned » bomarmonk
Status: Active » Reviewed & tested by the community

I'm not a coder, by any means, but I think this function is so simple it really doesn't need any review. Here's the render patch for Drupal 4.6.

merlinofchaos’s picture

The patch didn't get attached. (Sometimes they get lost if you attach, then preview, then submit)

bomarmonk’s picture

StatusFileSize
new591 bytes

One more try? Hopefully!

bomarmonk’s picture

Oh, one thing I've discovered: this added function only works if you allow the view to create a URL.

texas-bronius’s picture

This is great. I couldn't apply the patch in the method described in Handbooks, but appending it by hand at the end of views.module, it appears to work as expected.

michaelangela’s picture

This is a cool patch! I am only trying it out now, and I only added it manually appending it to the end as bcswebstudio mentioned. I modified it to work as a function call to be called within PHP type content sections so it can be in a story, page, etc. I am trying to see now about having it render without the links and other information though.

Thanks!

merlinofchaos’s picture

Status: Reviewed & tested by the community » Fixed
dnorman’s picture

Version: 4.6.x-1.x-dev » 4.7.x-1.x-dev

This is cool. Any ideas on a way to enable users (not geeks) to embed Views, say through the WYSIWYG editor? We're rolling out Drupal on campus here, and some end users will want to set up "news" or "events" pages within their various content pages. Ideally, a TinyMCE "Insert View" component would provide them with a list of available views, and embed the code into their content.

Any ideas?

RayZ’s picture

@dnorman: You mean like the Insert View module?

RayZ’s picture

Version: 4.7.x-1.x-dev » 4.6.x-1.x-dev
merlinofchaos’s picture

Sounds like a TinyMCE feature request to me.

dnorman’s picture

Yeah - I was looking for an "Embed View" module, and didn't find that particular module. That should totally do the trick. I'll see if I can whip up a TinyMCE plugin to help out the users...

Thanks for the pointer!

Anonymous’s picture

Status: Fixed » Closed (fixed)