Overview of Elgg as a framework
This overview covers basic questions about Elgg such as whether it is object-oriented and what kind of template language is used. These are the sorts of questions that are valuable to have answers to before looking at the design and structure of a framework.
What is Elgg?
Elgg is an open source framework for developing social networking and social media websites. It is written in PHP, uses MySQL for data persistence, and includes jQuery for client-side scripting.
Object-oriented or procedural?
The answer is both. The data model of Elgg is primarily object-oriented, while the rest of the framework is mostly procedural. This provides flexibility to plugin developers. For example, a page controller in Elgg can be a script, a function, or a class method. The choice is left up to the developer.
Does it use the Model-View-Controller pattern?
Elgg is not a textbook implementation of the Model-View-Controller (MVC) pattern. Elgg does not use the terminology of MVC, which can make it difficult at first to see the pattern. Viewing it from an MVC perspective, though, does make it easier to grasp Elgg's design.
Convention or configuration?
The answer to this question is also both. The model and controller use configuration exclusively and the view system is primarily convention-based with some configuration.
Is it extensible?
Elgg has a modular architecture that uses plugins to extend or modify the core engine. Without any plugins enabled, an Elgg site supports account creation, user settings, administration and not much else. This plugin-based approach gives developers flexibility and control when building web applications with Elgg.
Extensibility is also provided through an event-based hook system. Rather than editing core code, developers can modify the behavior of the framework by registering callbacks for an event. The callbacks perform their own processing of the data, prevent the core from taking an action, or change the output of a function. For example, every time a blog post is saved, an event is fired. A callback function registered for that event could check for spam and reject the post.
What template engine is used?
Elgg uses PHP as its template engine. This results in a flexible view system since the full power of PHP is available. Developers also do not have to learn a new template language to use Elgg as they would with an engine like Smarty. On the downside, an expressive template language such as PHP is a temptation to mix controller code into the views.