Sunday, December 15, 2013

Introduction to Elgg

10:19 PM

An Intro on Elgg - How to get started in Elgg Theming ?

Intro to Elgg

Elgg is a social networking framework that helps to build a social networking site in fair amount of time. It's written on PHP. Elgg can be compared to "PHP based CMS" designed for a social networking site so it can called as "social networking CMS" and also is based on MVC pattern. Elgg independently consist of its framework approach and does not depend upon existing frameworks. It can be a plus point and negative point as well also depending upon your existing familiarity with PHP MVC frameworks.

By visiting its official site ,, you can understand a lot about its core codebase and active community. Being a social networking CMS a normal user can also initiate it with minimum amount of time and run it with full flexibility.

Elgg is backed by community support and number of developers working on this platform are increasing. Which has created tremendous resources for learning. Therefore with freely available resources online developers can self learn to extend elgg according to their need. We can find many plugins and themes at the elgg community site. By checking out how these plugins and themes are built you can get much more information about the developmental pattern of elgg and understand plugins and themes better.

Architecture of Elgg

Elgg consists of controller and Modular Plugins System 
Elgg is built on MVC.

Folder Structure of Elgg

The primary folder structure includes

/mod → Plugins / themes stores
/engine → Elgg core files
/views → All views files resides here
/actions → Actions Controller
/documentation → Documentation of Elgg
/pages → Various Pages Controllers
/install → Installation folder ( Can be deleted after the installation )

A glimpse of the folder structure is shown above

Theming / Plugin development

By default elgg contains various important plugins built by the elgg developers itself. But depending upon the custom requirements for our social networks they might not be sufficient. So to fulfill our requirement according to our need we can make our own custom plugin/themes. Themes in Elgg are implemented as plugins. When we talk about building themes - we talk about building plugins.

Folder Structure of Plugins

All plugins are stored in "mod" directory in Elgg installation.
For activating plugins , log in with your administrator account , Administration -> Configure -> Plugins.
Find your plugin in the list of installed plugins and click on the 'Enable' button.

A  glimpse of the folder structure of a core plugin ‘blog’ is shown below

Plugin Manifest

Plugin Manifest is the information file related to plugin. It is an XML file located in the root folder of a plugin (see above picture of blog plugin). This file contains information about the plugin like author and version. The information stored here is viewed in admin dashboard as a plugin identifying information.

Plugin Hooks

Elgg plugins hooks are simple events that are triggered (executed) when an action has occurred and parts of that action can be overridden by a plugin. Though there are more cases when a plugin hook can be used because it is more general purpose than an Elgg event.

To get on plugin hooks first we have to register it by calling reister_plugin_hook() that will resides in start.php file

Simple plugin

A plugin development begins with creation of start.php file. It is very important due to the fact this file contains all the things that need to get operated while going through the plugin.
Among all the the features of elgg, one feature of elgg is that every aspects of the core are extensible.

Elgg contains lots of core plugins and default theme that you can start with . In elgg you can build theme/plugin starting over and in reference of existing plugins. 

Here themes are treated as plugins that override display aspects (views) of Elgg and should normally be placed at the bottom of the plugin list (in administration dashboard) so that the current theme runs last due to the fact that it need necessary component to load.

Overriding default views of “different elements/sections” - menu, header, footer etc

Elgg views depend upon the files located at default view folder. For customizing these views we create the file structures of which we want to extend such as menu, header, footer etc categories according to the folders.
View scripts are mapped to view name strings.
Elgg contains different files related to the design of the page views such as menu, header, navigation footer etc . Depending upon the choice we can extend these files and modify according to our necessity.
For New views use configuration as elgg_extend_view($view_name, $view_extension_name)
The similar files names are created in our own extended component. So if the files exists then the files are executed else the default files containing in mod directory get executed for the similar names.
Be careful with the file names as it should be identical to that of default directory.

Whenever we install a theme, we are overriding all or portions of the default theme.


A Good Overview from Elgg Core devs:

Official Documentation

Useful information

Written by

We are passionate programmers. Enjoying the rich platforms of Semicolon Family of Programming languages we are proud to call ourselves Semicolon Developers.


Post a Comment


© 2013 Echo "Semicolon Developers"; Kathmandu. All rights resevered @ Semicolon Developers Network Pvt. Ltd.. Designed by Templateism

Back To Top