forum.coppermine-gallery.net

Support => Older/other versions => cpg1.3.x Support => Topic started by: BMWHeaven on November 09, 2004, 07:32:14 pm

Title: if only one album in category --> go to album???
Post by: BMWHeaven on November 09, 2004, 07:32:14 pm
Hi, I've got a question,
If I've only got one album in a category, and the user clicks that category, is there a possibility redirect to the album in that category immediately?
I tried searching the forum for it, but didn't find anything...

I actually wanted to display all of the bmw models in a list like this:

|bmw models
|-3 series
||-old 3 series (only 1 album)
||-new 3 series (only 1 album)
|-5 series (has 2 albums)
|-7 series

just as an example....
Oh yeah, I dont want albums on the first page :)

Thanks a lot!
Ilir

Title: Re: if only one album in category --> go to album???
Post by: Tranz on November 09, 2004, 07:44:22 pm
If you are going to only have one album in a category, why not leave the album uncategorized? Then it would have a direct link from the first page of your gallery.
Title: Re: if only one album in category --> go to album???
Post by: BMWHeaven on November 09, 2004, 08:01:01 pm
-deleted-
Title: Re: if only one album in category --> go to album???
Post by: Tranz on November 09, 2004, 08:08:40 pm
Those are the kinds of details you need to provide in the first post. Otherwise you waste people's time providing answers that wouldn't work for you.
Title: Re: if only one album in category --> go to album???
Post by: BMWHeaven on November 09, 2004, 08:17:16 pm
Owkay, sorry mate....
I put it in my first post, cannot delete my second one though...
Will you help me now :) ???
Title: Re: if only one album in category --> go to album???
Post by: JasonB on November 10, 2004, 08:30:53 pm
Modify Coppermine so that bbcode is allowed in category titles.  Then edit the category so that it points directly to the one album.

You can patch Coppermine by editing the index.php file per:

Quote
First change all instances of:

Code: [Select]
$alb_list[$alb_idx]['album_title'] = $alb_thumb['title'];

to

Code: [Select]
$alb_list[$alb_idx]['album_title'] = bb_decode($alb_thumb['title']);

The full discussion that this is from is here (http://forum.coppermine-gallery.net/index.php?topic=10858.0) but, for your purposes, that's all you'd need to worry about.  The only thing to be aware of, with this, is that if you have a thumbnail for the category, and click on the thumbnail, it will not also take you directly to the gallery but to the category itself.  (Nobody's managed to figure out how to change the thumbnail link.)

In terms of the bbcode necessary for the category title, just go into the category as it is currently, right click on the gallery, and select "Copy Link Location" (or "Copy Shortcut" depending on your browser).  Then edit the definition of your category as follows:

Old
Code: [Select]
old 3 series
New
Code: [Select]
[url="http://..."]old 3 series[/url]
(Where "http://..." is replaced by pasting the URL you copied earlier - make sure that the quotes are there.)
Title: Re: if only one album in category --> go to album???
Post by: BMWHeaven on November 10, 2004, 11:52:16 pm
Hey,
thanks a lot for your reply, at least somebody that replies to what I ask, and is not summing up the guidelines for me....
I'll give it a try the way you mean, won't be doing it right away (busy with school at the moment).
I'll also read the other topic you posted, maybe it'll give me some more ideas.
If I ever find out that thumbnail link, I'll fire you a line...
Cheers mate,

Ilir
Title: Solution
Post by: BMWHeaven on November 12, 2004, 12:01:21 am
Well, for people who want to know this, I found it out myself.
This is what you do:
Find the file index.php in your coppermine folder.
then replace line 130:
Code: [Select]
$link = "<a href=\"index.php?cat={$subcat['cid']}\">{$subcat['name']}</a>";with:
Code: [Select]
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>";
}

That was all!

Ilir
Title: Re: if only one album in category --> go to album???
Post by: JasonB on November 20, 2004, 06:19:21 pm
Excellent!  That's even better than the bbcode method (for me) because I can now have categories that link directly to single galleries inside AND also use thumbnails for the categories.