How elgg works

November 23, 2007

Ok I’ve finished with elgg now, and I managed to get it do everything I needed to do. Although it is quite a good system from the perspective of its functionality, my previous criticisms of the code still stand – functionality and display aren’t separated as well as they might be, and the general structure of the code is a little obscure. Another demonstration that MVC is very hard to beat when it comes to web applications.

That’s not to say you shouldn’t use it, of course, like I said it’s doing what I need now. Here’s some information on the structure of it that might be helpful if you’re using it:

  • “modules” are in /mod/ … it’s hard to know exactly is meant by a module, because there’s a profile/ directory in /mod/ but also in /units/, and also there’s a /profile/ directory … but anyway, each module is initialised by a function called <modulename>_pagesetup() in /mod/<modulename>/index.php
  • Menus are stored in $PAGE. The main menu is intialised in /lib/displaylib.php, and added to in the initialisations of individual modules (in the <modulename>_pagesetup() functions)
  • Lots of the functionality is executed by a function called run() in /units/engine/library.php … this works by including particular files (indicated by the function params) whose filenames are contained in the array $function which is populated by the <modulename>_pagesetup() functions. If you want to see the code called by run(“search:display”) just do a full-project search for $function[‘search:display’][] and see what file it refers to.

Note that the code doesn’t stick to the php convention of capitalising constants, and be sure and use an IDE with “search all files” and “go to declaration”, you’ll get lost if you’re just using notepad or vi

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: