Gallery Block
by Andy Maloney [asmaloney@users.sf.net]
07 Mar 2005
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 release called '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.
Developed using:
- gallery 1.4.4-pl6
- geeklog 1.3.11
- PHP 5.0.3
Version History
- v1.1.2 [07 Mar 2005]
- use a different function from gallery for generating URLs so that the rewrite preference is respected [reported by Ajay Gopal]
- v1.1.1 [27 Mar 2004]
- v1.1.0 [22 Mar 2004]
- optionally show nested albums [now the default behaviour]
- v1.0.1 [20 Feb 2004]
- no longer produces an error when the cache file does not exist [reported by Rogan Lynch]
- removes newlines from album titles and date formats [reported by Rogan Lynch]
- checks that albums in the cache actually exist before trying to use them [in case an album has been deleted or renamed since the cache was created]
- minor code cleanups
- v1.0.0 [09 Feb 2004]
Upgrade/Installation
A note on paths:
- a path beginning with ./ is the directory this README is in
- /path/to/geeklog/public_html/ is where your lib-common.php file may be found
- a path beginning with geeklog/ is where your config.php file for geeklog may be found
New Installation
- Copy the ./public_html/galleryblock directory to /path/to/geeklog/public_html/
- Copy the ./blocks/galleryblock directory to the geeklog/blocks/ directory [you may have to create geeklog/blocks/]
- Copy the function from add-to-lib-custom.php into your lib-custom.php file located in the geeklog/system/ directory
- Configure the block by changing geeklog/blocks/galleryblock/config.php. At least the $GALLERY_BASEDIR will have to be changed
- 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.
Upgrading 1.1.1 to 1.1.2
- Copy ./blocks/galleryblock/phpblock.php to the geeklog/blocks/galleryblock directory
Upgrading 1.0.1 to 1.1.1
- Disable the Gallery Block using Admin->Blocks
- Copy ./blocks/galleryblock/phpblock.php to the geeklog/blocks/galleryblock directory
- In geeklog/blocks/galleryblock/config.php, change this:
$GB_CONF['lu_image_path'] = $_CONF['path'] . 'galleryblock/update.gif';
to this:
$GB_CONF['lu_image_path'] = 'galleryblock/update.gif';
- Enable the Gallery Block using Admin->Blocks
Upgrading 1.0.1 to 1.1.0
- Disable the Gallery Block using Admin->Blocks
- Delete the current cache file
- Copy ./public_html/galleryblock/galleryblock.php to the /path/to/geeklog/public_html/galleryblock directory
- Add the 'Nested Albums' section from ./blocks/galleryblock/config.php to your config.php file and tune to your requirements
- Enable the Gallery Block using Admin->Blocks
Upgrading 1.0.0 to 1.0.1
- Disable the block using Admin->Blocks
- Delete the current cache file
- Copy ./public_html/galleryblock/galleryblock.php to the /path/to/geeklog/public_html/galleryblock directory
- Copy ./blocks/galleryblock/phpblock.php to the geeklog/blocks/galleryblock directory
- [No changes are required to config.php or the function in lib-custom.php]
- Enable the block using Admin->Blocks
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.
3. Why do I get this PHP warning: "session_start(): Cannot send session cookie - headers already sent by..."?
Well, I don't really know what causes this. I solved it by setting output_buffering in my php.ini to 'On'. If anyone can tell me what's going on, I'd appreciate it.
Things You Can Do
- Check my PHP and tell me if there are better ways to do any of this. [email me]
- Let me know if you use it or have any suggestions. [email me]
- Support development by making a donation:
or by using one of the following links to shop at amazon:
License
This is licensed under my special 'Do-Whatever-You-Want-With-It' license. So... do whatever you want
with it.