CMS Made Simple Forums
https://forum.cmsmadesimple.org/

[Tip] Lazy Loading.
https://forum.cmsmadesimple.org/viewtopic.php?f=74&t=56377
Page 1 of 1

Author:  calguy1000 [ Wed Aug 24, 2011 8:03 pm ]
Post subject:  [Tip] Lazy Loading.

Here's a tip for people that are updating their modules.

For a number of modules that display content, but may not be used on every page, I've enabled frontend lazy loading by merely adding this method:

function LazyLoadFrontend() { return TRUE; }

then bumping the version number.

The system should then load the module only when it's required. This will work fine for many cases. However, if the module provides classes for uses by other modules, or registers multiple plugins then lazy loading is probably not possible.

Additionally, if the module registers an event handler that is called on every page (like ContentPostRender)... then although the lazy loading should work, it's essentially useless as the module has to be loaded on every frontend request anyways. Another reason that that event should be used sparingly.

Just a tip for module developers.

Author:  Jos [ Wed Aug 24, 2011 8:24 pm ]
Post subject:  Re: Lazy Loading.

calguy1000 \calguy1000:
Additionally, if the module registers an event handler that is called on every page (like ContentPostRender)... then although the lazy loading should work, it's essentially useless as the module has to be loaded on every frontend request anyways.


Thanks for this explanation... was playing with this on Gallery and was wondering why it still was loaded despite the LazyLoadFrontend function

Author:  Wishbone [ Wed Aug 24, 2011 8:27 pm ]
Post subject:  Re: Lazy Loading.

My module (OwnersManual) is only used in the back end.. I assume that I should use Lazy Loading so that it doesn't get loaded on each front end page load?

Author:  Jos [ Wed Aug 24, 2011 8:47 pm ]
Post subject:  Re: Lazy Loading.

Yep, guess so...

And this will help: viewtopic.php?f=6&t=55055

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/