Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: if only one album in category --> go to album???  (Read 4899 times)

0 Members and 1 Guest are viewing this topic.

BMWHeaven

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
    • http://www.bmwheaven.com
if only one album in category --> go to album???
« 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

« Last Edit: November 12, 2004, 12:45:00 am by TranzNDance »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: if only one album in category --> go to album???
« Reply #1 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.
Logged

BMWHeaven

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
    • http://www.bmwheaven.com
Re: if only one album in category --> go to album???
« Reply #2 on: November 09, 2004, 08:01:01 pm »

-deleted-
« Last Edit: November 09, 2004, 08:17:59 pm by BMWHeaven »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: if only one album in category --> go to album???
« Reply #3 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.
Logged

BMWHeaven

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
    • http://www.bmwheaven.com
Re: if only one album in category --> go to album???
« Reply #4 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 :) ???

JasonB

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 37
    • The Big Squiff
Re: if only one album in category --> go to album???
« Reply #5 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 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.)
« Last Edit: November 10, 2004, 08:36:55 pm by JasonB »
Logged

BMWHeaven

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
    • http://www.bmwheaven.com
Re: if only one album in category --> go to album???
« Reply #6 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

BMWHeaven

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 33
    • http://www.bmwheaven.com
Solution
« Reply #7 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

JasonB

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 37
    • The Big Squiff
Re: if only one album in category --> go to album???
« Reply #8 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.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.