[Tip] Lazy Loading.

A place to report and discuss issues with the CMSMS 1.10 beta.
Locked
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

[Tip] Lazy Loading.

Post by calguy1000 »

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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Jos
Support Guru
Support Guru
Posts: 4017
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Lazy Loading.

Post by Jos »

calguy1000 wrote: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
Wishbone
Power Poster
Power Poster
Posts: 1369
Joined: Tue Dec 23, 2008 8:39 pm

Re: Lazy Loading.

Post by Wishbone »

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?
Jos
Support Guru
Support Guru
Posts: 4017
Joined: Wed Sep 05, 2007 8:03 pm
Location: The Netherlands

Re: Lazy Loading.

Post by Jos »

Yep, guess so...

And this will help: http://forum.cmsmadesimple.org/viewtopi ... =6&t=55055
Locked

Return to “[locked] CMSMS 1.10 Beta”