[buddypress-dev] JIT Inclusions
Chris Taylor - stillbreathing.co.uk
mrwiblog at gmail.com
Wed May 6 22:29:21 GMT 2009
Hey,
I think I have to agree with Austin about this. If several components
are in use on one page (which is certainly true for the member profile
page) then all that code is loaded into memory whether we like it or
not. However if you really want to load components just in time then
you need two things:
1) A way for each component to register itself with a central system
2) A simple call to initialise that component and pull in the relevent files
In psuedo-code this would be something like:
bp_register_component("groups", array("groups_file_1", groups_file_2"));
Parameter one is the unique name of the component, and the name of the
folder in which resides the files needed to run that component.
Parameter 2 is a list of the files needed. The good thing about this
is BP can check for the existence of each component file, and if there
is anything missing the whole lot can stop being loaded.
On a page you want to use that compnent you'd do something like:
bp_initialise_component("groups")
I guess you've already thought of this and found the holes in it, yes?
Chris
More information about the buddypress-dev
mailing list