View Single Post
  #1  
Old 10-08-2004, 06:18 PM
pixelpunk's Avatar
pixelpunk Offline
pixelpost guru
 
Join Date: Oct 2004
Location: Sweden
Posts: 504
Send a message via ICQ to pixelpunk
Create Your Own Addons

With version 1.1 the possibility to easily write addons for the script is introduced.

As an example, very basic, an addon that returns the current date and time is provided. It's entire code as follows (comments inside script removed):

PHP Code:
$addon_name "Pixelpost Current DateTime";
$addon_description "Displays current date and time as reported by the server.<br />
Format is: date(\"Y-m-d H:i:s\")<br />
 An example of how to create addons."
;
$addon_version "1.0";

$current_date_time date("Y-m-d H:i:s");
$tpl ereg_replace("<CURRENT_DATE_TIME>",$current_date_time,$tpl); 
The possibilities with this can be huge, if you're into this sort of thing.
The above script replaces the <CURRENT_DATE_TIME> tag within a template with the current date and time, obviously.
The variables from the main script is available, and can be overwritten, so be careful to name your variables.
Your addon is inserted to the script as an include().

This is provided for those who wish an easy way to add functionality without altering the main script, which in turn will make it easier to update in the future.

And, it is good for me. I wish to keep the main pixelpost thing EASY and BASIC, but yet still have the chance to expand it without cluttering the main download. Reasoning is that if a user wants the basic functionality it's there in the default install.
If I come up with added functionality that somewhat expands beyond the fundamental needs of a photoblogger, it will be provided as an addon.

Last edited by GeoS; 03-15-2007 at 12:31 AM. Reason: changed tag used to show addons code from [code] to [php]
Reply With Quote