0

In reading Drupals Building Blocks, in the discussion about optimizing an sql query, it mentions embedding queries.

I've read all the pros/cons and for one specific page I have, I would like to embed four different displays of one view so I'm trying to figure out the best place to do this.

My goal is that the "Maximum execution time of 30 seconds exceeded" will fall away. There is no problem anywhere on the site except for this one page (which was a marketing brain-child to put everything on one page; in affect to disregard the rest of the site).

Do I create a page.tpl.php specific template and stick the code there or somewhere else?

I was trying to use:

$view = views_get_view('my_view_name');
print $view->execute_display('Display One Here');

But in addition to putting it in the right place, do I list the display with quotes and commas as in 'display two here', 'display three here' or do I need to repeat the print $view-> for each display?

Of course, maybe there is a better way to do all of this?

The page in question generates a long list of products.

  • Do you not just need to define a menu_hook() and put your code inside the callback for that? – Daniel Harper Oct 2 '13 at 8:24
0

I guess the Entity view attachment module is what you would require to use.

The Entity Views Attachment (EVA) module extends the Views module to allow you to attach a view to any entities on your site. The placement of the view in the entity's content can be reordered on the "Field Display" administration page for that entity, like other added fields.

Views on its own will let you create a page for your view, with its own URL, and it also lets you attach multiple views to the same Views page, but it doesn't let you do something like attach a view to a node, or a user

One good example of this module is available at: https://drupal.stackexchange.com/questions/5732/is-there-a-good-tutorial-for-entity-views-attach-module

  • 1
    ah, well I neglected to mention this is for a Drupal 6 site. Also, it appears that module wouldn't really provide a faster sql query; it's just an 'attachment on steroids' type of mod. I'm trying to permanently cache a view on one page w/o actually copying/pasting the html generated itself. That would remove an sql query entirely of course, but I'd rather not resort to that. – kelly johnson Oct 1 '13 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.