Gallery Block

by Andy Maloney [asmaloney@users.sf.net]
20 Feb 2004

I downloaded the 'Gallery Last Updated' block from squatty.com by Danny Ledger and others and it did not really fit with what I needed, so I rewrote it. Inspired by the 'Gallery Top 10' block, also from squatty.com, I wanted to add the most viewed albums, so I more-or-less rewrote it again and renamed it 'Gallery Block'. This replaces my previous 'Gallery Updates Block'.

Description

This block displays a listing of recently updated albums and/or a list of the most viewed albums in your gallery. It will only list albums visible to the current user. It is pretty customisable using the config.php file.

Written using:

Version History

Upgrade/Installation

A note on paths:

Upgrade 1.0.0 to 1.0.1

  1. Disable the block using Admin->Blocks
  2. Delete the current cache file
  3. Copy ./public_html/galleryblock/galleryblock.php to the /path/to/geeklog/public_html/galleryblock directory
  4. Copy ./blocks/galleryblock/phpblock.php to the geeklog/blocks/galleryblock directory
  5. [No changes are required to config.php or the function in lib-custom.php]
  6. Enable the block using Admin->Blocks

New Installation

  1. Copy the ./public_html/galleryblock directory to /path/to/geeklog/public_html/
  2. Copy the ./blocks/galleryblock directory to the geeklog/blocks/ directory [you may have to create geeklog/blocks/]
  3. Copy the function from add-to-lib-custom.php into your lib-custom.php file located in the geeklog/system/ directory
  4. Configure the block by changing geeklog/blocks/galleryblock/config.php. At least the $GALLERY_BASEDIR will have to be changed
  5. Login to your web-site and add a new block using the Block Manager. Make sure you select "PHP Block" as the block type. Use phpblock_GalleryBlock as the block function.

    NOTE: This block MUST NOT be visible at the same time as your gallery page. The easiest way to ensure this is to put it on the right or only on the homepage.

Customisation

There is a config.php file located in the geeklog/blocks/galleryblock/ directory. It contains descriptions of all the options. You can edit the HTML in the geeklog/blocks/galleryblock/phpblock.php file. You shouldn't need to change anything in the /path/to/geeklog/public/html/galleryblock/ directory.

Mini FAQ

1. Can I use the Gallery Block with multiple gallery installations?
No. Because this block includes files from the gallery installation which define functions, trying to include them multiple times results in PHP errors. At this time there is no way that I know of to work around this.
2. Why do I get this PHP error: "Fatal error: Call to a member function on a non-object in /path/to/gallery/classes/User.php on line 136"
This may be caused by a problem with the title of your gallery. Version 1.0.1 of Gallery Block tries to fix this by removing newlines from gallery titles.

Notes

License

This is licensed under my 'Do-Whatever-You-Want-With-It' license. So... do whatever you want with it.