0

I've got a d7 site on a shameful shared hosting account.

Since I am a pseudo haxxor, I want to load up my front page view and manually output all of my nodes. My Front Page takes about 30 seconds to load in the worst case. I am tears.

Here is what I am doing:

$view = views_get_view_result('main_feed');
foreach($view as $item){
    $node = node_load($item->nid,NULL, TRUE);
    /* assorted display code */
}   

Any thoughts? 2.7 trillion thanks to all!

EDIT:

Well @Druplaist was right - this SHOULD work - after reading my own question I thought "If somebody else were asking this, I'd suggest that the problem was inside of /* assorted display code */ - and it is - probably some truncating method I grabbed. It's still Drupal slow, but not 30 seconds till the server gets back to me slow.

Thanks for answering my stupid question, people!

  • use panels and page manager to build up your first page and you can add caching options , it makes every thing much better – Alireza Tabatabaeian Jul 17 '15 at 12:38
1

Since you need to load all of the nodes on your front page, Not that much difference does it make how you implement it, whether using code or loading View in a page or block or ....

views_embed_view do the same thing and loads a View but it doesn't reduce the load size!

I recommend you to to use Ajax. The Views Load More module is exatcly what you need. This module

  • Provide ajax/no-ajax views load more
  • Works with views default ajax implementation, no hacks (check/uncheck ajax)
  • Supports the Waypoints module for loading on various points, Such as when the scroller is visable on the page.
  • Supports the Fade effect when loading new content.

Instead of loading all of your content, simply just load 100 or 200 of them then use Ajax to load more.

Views Show More module is another solution. This module

  • Works both views ajax and no-ajax mode (developed mainly for the ajax mode).
  • Option for result display method. Can choose Append or Replace method.
  • Option to override 1st page or initial item count than others page.
  • Basic and advance animation system for result impression for ajax mode.
  • Ability to define custom animation timing.
  • Advance settings for content area and pager area selector. If default html

In the aggregate, create a View of all of the content types that their nodes must be included in the front page, include that view in the front page and use one of the above modules to use load more.

  • Oh, I am a silly - read my edit and thanks for the other load speed tips. – Trass Vasston Jul 17 '15 at 15:38

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.