It would be great to have a simple function to render a view in any place of the site (inside pages or blocks, for example). Something like:

theme_view( 'view_name', 'page|block' )

There are many cases where a view must be rendered in a specific point of the site, or in the middle of some text. Today, we have to define a new region in the template.php file, set the view block to that region, and then place a theme( 'blocks', 'region_name' ) in the point you want it. Then, you will never change the region anymore, so if would be much better to use theme( 'view', 'view_name', 'block' ) instead, without having to make changes in the template.php.

Regards,
FredCK

CommentFileSizeAuthor
#2 views.module_0.diff1.49 KBFredCK

Comments

RayZ’s picture

Is the Insert Views module what you're looking for?

FredCK’s picture

Version: 4.7.x-1.x-dev » 6.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new1.49 KB

Thanks for the module tip RayZ. It is another solution for the same problem. But it lacks on features and it adds another filter in the process, which is less performance than a direct function call.

I'm proposing a theme_view() function in the attached diff. It is ridiculously simple, so it would not be a big deal to have it (and it works in the phptemplate theme fashion).

In this way we have the choice to use the function of the Insert View module. Actually this new function could also be used by the "Insert View" module to render the view.

Regards,
FredCK

merlinofchaos’s picture

Status: Needs review » Fixed

Sure, why not.

Anonymous’s picture

Status: Fixed » Closed (fixed)