Welcome to Geeklog, Anonymous Friday, December 06 2024 @ 05:50 am EST

Geeklog Forums

Archive Plugin


Status: offline

Euan

Forum User
Full Member
Registered: 04/22/02
Posts: 292

I've just written an "Archive" plugin for someone.

It's quite simple, but very powerful. The quickest way to understand, is to look at it here.

The archive plugin creates an "archive" item, which is a document with just a title and a description. However, an archive item can contain other archive items, creating a hierarchy. It can also contain "text" items, which are just a title and text box and are displayed in full within the archive item. Also, archive items can contain address items, which are just addresses.

Finally, archive types can contain links to "related" items - which are items from any compatible plugin. I have written simple functions for including links, filemanagement files, mediagallery albums, staticpages, and calendar events. Mark (MediaGallery) has suggested he might help with including thumbnails, and I'm thinking about what to do with forum - probably just include a link to a forum of choice. I shall probably also work out some way of linking archive items to other relevant archive items.

I've created this for someone who wanted to build a business directory, and I think it will do that very well. It should be very flexible, and I hope it will become a popular addition to the Geeklog plugins selection. What I would like now, since it is almost ready, is any input on what other data items/plugins you'd like supported. If something is available in a plugin (eg events, links) I have no intention of including it as a special data type/item within the plugin. But, as there is no suitable address plugin, I have included addresses in the archive plugin. Any more?

If any plugin developers are interested in having their plugins integrate, drop me a line and we can talk. The basic functions I created to integrate the MediaGallery plugin are below (note security not checked yet).

Cheers,

Euan.

Text Formatted Code
<?php

// PHP for MediaGallery to return albums to include in Archive.
// This creates a simple list of albums to include.

// +---------------------------------------------------------------------------+
// | MediaGallery                                                              |
// +---------------------------------------------------------------------------+

/**
* Returns the plugin name
*/

function archive_mediagallery_name()
{
    global $LANG_MG00;
    return $LANG_MG00['menulabel'];
}

/**
* Returns a list of all MediaGallery albums
*/

function archive_make_mediagallery_list()
{
    global $_CONF, $_TABLES, $LANG_AR;
    $retval = '<select name="relatedid">';
    // Get staticpage title from DB
    $perms = COM_getPermSql();
    $result = DB_query ("SELECT album_id,album_title FROM ".$_TABLES['mg_albums'] . " " .$perms);
    $nrows  = DB_numRows ($result);
    if ($nrows > 0) {
        for ($i = 1; $i <= $nrows; $i++) {
            $A = DB_fetchArray ($result);
            $retval .= '<option value="'.$A['album_id'].'">'.$A['album_title'].'</option>';
        }
    }
    $retval .= "</select>";
    return $retval;
}

/**
* Returns array of title and link to a MediaGallery given id
*/

function archive_mediagallery_item ($id)
{
    global $_CONF, $_TABLES, $LANG_AR;
    $retval = '';
    // Get staticpage title from DB
    $perms = COM_getPermSql('AND');
    $result = DB_query ("SELECT album_title FROM {$_TABLES['mg_albums']} WHERE (album_id='{$id}') ". $perms);
    $nrows  = DB_numRows ($result);
    if ($nrows > 0) {
        $A = DB_fetchArray ($result);
        $retval['title'] = $A['album_title'];
        $link = $_CONF['site_url'] . "/mediagallery/album.php?aid=".$id;
        $retval['link'] = $link;
    } else {
        $retval['title'] = "No such item";
        $retval['link'] = "";
    }
   return $retval;
}

?>

-- Heather Engineering
-- No job too small
 Quote

Status: offline

Euan

Forum User
Full Member
Registered: 04/22/02
Posts: 292
Archive plugin 1.0 is available for download on my site or on Geeklog.net when it is approved.

Please add any bug reports/feedback/feature requests here.

You can also try it out on my site - logged in users only.
-- Heather Engineering
-- No job too small
 Quote

All times are EST. The time is now 05:50 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