if only one album in category --> go to album??? if only one album in category --> go to album???
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

if only one album in category --> go to album???

Started by BMWHeaven, November 09, 2004, 07:32:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

BMWHeaven

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


Tranz

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.


Tranz

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.

BMWHeaven

Owkay, sorry mate....
I put it in my first post, cannot delete my second one though...
Will you help me now :) ???

JasonB

#5
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:

$alb_list[$alb_idx]['album_title'] = $alb_thumb['title'];


to

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

The full discussion that this is from is here 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 old 3 series

New [url="http://..."]old 3 series[/url]

(Where "http://..." is replaced by pasting the URL you copied earlier - make sure that the quotes are there.)

BMWHeaven

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

BMWHeaven

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:
$link = "<a href=\"index.php?cat={$subcat['cid']}\">{$subcat['name']}</a>";
with:
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

JasonB

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.