Coppermine: Category -> album if there is only one.
Posted: Sat Nov 20, 2004 12:32 pm
Here's how to reconfigure Coppermine so that if there's only a single album in a category, when you click on the category link it will take you directly to it - rather than requiring you to click on the category and then also on the album:
Find the file index.php in your coppermine folder.
then replace line 130:
with:
This comes from the user "BMWHeaven" from this discussion thread.
This functionality can also be obtained by allowing BBCode in category titles as per this discussion, but the BBCode method isn't nearly as elegant since there are a few problems with it.
Find the file index.php in your coppermine folder.
then replace line 130:
Code: Select all
$link = "<a href=\"index.php?cat={$subcat['cid']}\">{$subcat['name']}</a>";
Code: Select all
if ($album_count==1)
{
$sql = "SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$subcat['cid']} LIMIT 0,1";
$result = db_query($sql);
$aid = mysql_fetch_row($result);
mysql_free_result($result);
$link = "<a href=\"thumbnails.php?album=$aid[0]\">{$subcat['name']}</a>";
}
else
{
$link = "<a href=\"index.php?cat={$subcat['cid']}\">{$subcat['name']}</a>";
}
This functionality can also be obtained by allowing BBCode in category titles as per this discussion, but the BBCode method isn't nearly as elegant since there are a few problems with it.