#5 event handlers

open
nobody
None
5
2002-01-29
2002-01-29
Marius Scurtescu
No

Adding a simple event handling schema could help a lot
in extending and integrating the script.

The event handling could be implemented like this:
- A file with a set of well know functions acting as
event handlers.
- These functions will be called when specific events
occur.
- Some of these function could have default
implementations.

For example. Such a function could be:
function NewLinkAdded ($title, $description, $url,
$category)
{
...
}

By default this could send out an email to the site
admin. If info about the submitter is collected then
such and email can be send to the submitter as well
telling him that the submittion will be reviewed shortly.

Another such function could be:
function NewLinkProcessed ($title, $description, $url,
$category, $action)

This could send an email to the original submitter
letting him know that his site was approved/rejected.

Examples of events:
- adding a new link
- adding a new category
- editing an existing link
- processing of a new link
- processing of a new category
- processing of an existing link
etc.

Regards,
Marius

Discussion

  • Logged In: YES
    user_id=25046

    Here is an implementation of the event handler. It can be
    extended for many other events following the same idea.

    The attachment contains three files:
    - Config.php - two new global configs were added:
    admin_email and base_url
    - lib_addupdate.php - this file calls the handlers
    - lib_events.php - the event handlers

     
  •  
    Attachments
  • Olle Johansson
    Olle Johansson
    2002-08-14

    Logged In: YES
    user_id=317967

    Sounds like a great idea, I would really like this feature.

    /Gardener