Welcome to Geeklog, Anonymous Tuesday, June 25 2024 @ 06:01 am EDT

Geeklog Forums

Idaes for Geeklog 2 customization system.

Status: offline


Forum User
Regular Poster
Registered: 08/13/03
Posts: 107
WARNING - Lengthy technical post, I'm making an assumption here that my readers understand the basics of object oriented programming in php.

I've been noticing lately that there are always a lot of requests from people who want to make small changes to the geeklog system that require directly editing geeklog code. Now, obviously, since geeklog is open source, this works, but it means anytime a new version comes out, they may have to reintegrate their code. Additionally, it is difficult to distribute hacks as they may require adding a bunch of lines in multiple places. Having said that, the system does work to allow customization.

I would like to throw out an Idea that I've used on some of my PHP projects lately, which could be useful for designing the framework of Geeklog 2. Esentially, the idea is to use all of the object-oriented nature of PHP, and make each story, block, etc.... an object instance. Now, when these objects are stored in the database, add a column which provides the name of the class that the object is created from. Using hte example of stories, most stories would be gl_basic_story. This class would have functions for story creaion, story display, story saving (into the database) story loading, etc....

Now, imagine someone wants to create stories that display in a two column layout (yes I know you could insert a table into the html of a story, but this is just an example). They can create a new gl_twocolumn_story class in a gl_custom_classes.php file This new class inherits the gl_basic_story class, but provides its own display_story function, which overrides that of the base class. So, now, they have modified the story class, but without actually changing any of the base code. And, if the class is stored on a per-story basis, then different stories can be implemented using different derived classes and they can all peacefully co-exist in the same DB. Also, distributing derived classes would be quite easy (more so than distributing modified versions of the base files) and the classes are very unlikely to conflict with eachother (if you want to use two different hacks right now you always run the risk that files from one hack will overwrite files from another hack)

The more the code was broken into small functions within the base class, the more flexibility the user would have to override just the chunk of code they wanted to change.

Anyway, I just thought I'd offer this as an idea. I would be very interested to know what people think. (assuming I explained myself clearly enough to be understood, technical writing is not my specialty) Criticisms, and additional ideas would be welcome as well.



All times are EDT. The time is now 06:01 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content