Coppermine Tag Cloud on the Home Page

Coppermine gallery is a great piece of software, as of version 1.5.3 RC it has the ability to display ‘tags’ on the search page of your gallery and then you can click on one of those tags to display all pictures that have been assigned with that specific keyword. To see what i mean, see bellow:

Coppermine Tag Cloud

And when you click through from one of the keywords you should see:

Coppermine Search Tag Cloud - BruteSo that’s great, but the tags are hidden away on the search page, wouldn’t it be great to show these on the home page somewhere? Luckily is relatively simple to achieve.

First things first is to head to the config page and then to the ‘Album list view’ area, you need to edit the ‘The content of the main page’ section, which in my case has:

breadcrumb/alblist/catlist/toprated,2/lastcom/lastup/random/anycontent

Yours will be similar to this, what you will need to add to yours is the ‘anycontent’ bit where you would like the tags to be displayed. A short description of anycontent:

‘anycontent’: inserts php-generated content that has to reside within the file ‘anycontent.php’ into the index page. Can be used to include banner-rotation scripts or similar.

So go ahead and open up your anycontent.php that should be located in the root directory of your gallery installation, yours may be blank, or may contain some other data, for this example you can use the code bellow to display the tag cloud on your home page only. If you already have functional code in there it will be overwritten..

<?php
/*************************
Coppermine Photo Gallery
************************
Copyright (c) 2003-2010 Coppermine Dev Team
v1.0 originally written by Gregory Demar

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3
as published by the Free Software Foundation.

********************************************
Coppermine version: 1.5.3
$HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/anycontent.php $
$Revision: 6985 $
$LastChangedBy: gaugau $
$Date: 2010-01-02 11:38:29 +0100 (Sa, 02. Jan 2010) $
**********************************************/

/**
* This file gets included in index.php if you set the option on the configuration panel: “content of the main page”.
* It can be used to display any content from any program, it is to be edited according to one’s tastes.
*/

if (!defined(‘IN_COPPERMINE’)) {
die(‘Not in Coppermine…’);
}

starttable(“100%”, ‘Tags’);

if ($CONFIG[‘clickable_keyword_search’] != 0) {
include(‘include/keyword.inc.php’);
}

endtable();

?>

Leave a Reply