Geeklog 2 is nothing more than a kernel, not all that different from how the Linux kernel operates. The Linux kernel provides support for the most basic needs that applications need to run. Things like security, memory management and some fundamental modules that applications running on it can make use of. In that light, Geeklog 2 does nothing terribly useful out of the box. It provides user management, security, event handling, plugin management and a number of libraries that plugins can make use of.
That said, to develop plugins under Geeklog 2, you will need to understand how the kernel is organized, what libraries you have at your disposal and what you need to do to start building your plugin. This article will be your guide to developing under Geeklog 2 and will evolve as Geeklog 2 evolves.
So you wanna develop a Geeklog 2 plugin, eh? Well the first thing you will need to do is get the source code. Simply follow the instructions to get a check out from CVS. Installing the kernel is still very much manual (something we plan to change) so you'll need to do these few things to get started:
$glConf['path'] $glConf['site_url'] $glConf['dbms'] $glConf['db_host'] $glConf['db_name'] = 'Geeklog_2'; $glConf['db_user'] = 'root'; $glConf['db_pass'] = 'f00bar';
#>mysqladmin -u-p create Geeklog_2
#>mysql -u-p Geeklog_2 < /path/to/Geeklog-2/sql/MySQL/create.sql
If all went well, you are deserving of congratulations as you have the Geeklog 2 kernel installed and are now ready to develop your plugin. The first thing you will need to do is let the kernel know about your new plugin. This is as easy as running the following SQL:
#>INSERT INTO gl2_plugin
(logical_name, display_name, version, homepage, enabled, owner_default_rights)
VALUES ('link','Link Manager', '0.1', 'http://www.example.com', 1, 3);
Obviously you will need to change all of that information to respresent your plugin. The logical_name is a single string with no spaces that identifies your plugin. It must be unique to other plugins and will be see in the URL so take care to pick a name that is meaningful but short as possible. The display name is the name we will typically show for the plugin on any of the kernel screens. For version, homepage, enabled and owner_default_rights, just use the values in the above example for now. We will explain what those are later.
Ok, now the GL2 kernel is aware that your plugin exists. The next thing you should do is create a stub of your plugins files. We've made this easy, just get the file from here You will want to unzip those to /path/to/geeklog2/plugins/. Now before you are off writing code for your plugin, you have just a bit of work to get your bare bones project working. You might have noticed that the zip uncompresses into a single folder called BareBones. You will need to rename that folder to match the logical name you gave your plugin above. Then you need to do the following:
Now your first Geeklog 2 plugin should be working! Verify it by going to http://www.yourgl2site.com/index.php/pluginlogicalname/ and, of course, you would replace pluginlogicalname with the logical name you gave your plugin. With any luck you now see your first Geeklog 2 plugin page.
Next update to this article we will explain how to interact with the Geeklog 2 database, explain what Creole and Propel are and how together with the Geeklog 2 Data Access Object, they will prevent you from writing any SQL as you build your plugin!
Comments (0)
Geeklog
http://www.geeklog.net/article.php/DevelopGL2Plugins