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: hide empty album/category  (Read 8719 times)

0 Members and 1 Guest are viewing this topic.

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
hide empty album/category
« on: April 12, 2011, 10:24:12 pm »

Is it possible to hide empty albums/categories until a file are uploaded to that album/category?
I have searched the forum but could only find an answer to my question for coppermine version 1.3
see my link
http://www.palmero.se/cpm_test/index.php
there i have two empty albums and want them to be hidden until a file are uploaded to it.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #1 on: April 13, 2011, 10:18:12 am »

To hide empty categories, copy the function theme_display_cat_list to your theme.php file if it doesn't exist. Then, comment out
Code: [Select]
echo template_eval($template_noalb, $params);

To hide empty albums, copy the functions theme_display_album_list and theme_display_album_list_cat to your theme.php file if they don't exist. Then, find
Code: [Select]
foreach($alb_list as $album) {and below, add
Code: [Select]
            if ($album['pic_count'] == 0) {
                continue;
            }
in both functions.
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #2 on: April 13, 2011, 01:44:45 pm »

My phpknowledge arent what i want it to be yet, can you please tell me more if it are any specific place the code must be in and if its some more code that needs to be added.

BR
P-O
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #3 on: April 13, 2011, 02:23:48 pm »

Have a look at the file 'theme.php' in your theme folder. If the mentioned functions aren't present, copy them from themes/sample/theme.php to your theme's theme.php file, directly before the closing
Quote
?>
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #4 on: April 22, 2011, 08:39:52 am »

I now have the sections:
theme_display_cat_list
theme_display_album_list
and
theme_display_album_list_cat
in my theme.php, my theme is hardwired
I copied the sections from the sample theme as you mentioned and put it before the closing, but i still see the category and albums that are empty.
The page are now live at http://galleri.fkljusdal.se
What can be wrong?
Thanks in advance
P-O
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #5 on: April 24, 2011, 09:11:05 pm »

After som more testing i succeded to hide albums, not the empty ones though, it, what can be wrong?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #6 on: April 26, 2011, 02:13:03 pm »

I copied the sections from the sample theme as you mentioned and put it before the closing, but i still see the category and albums that are empty.
Don't forget to apply the modifications.
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #7 on: April 26, 2011, 07:17:35 pm »

Done that now but still it hide to much, it hides both empty albums and albums with photos in, i have done albums for some categories like nature, portrait and so on, and on the first page the albums doesnt show, but if i look at the user galleries it show all users photos, is it that the photos are just linked to the albums or?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #8 on: April 26, 2011, 08:14:07 pm »

So the albums that will be hidden incorrectly contain just linked files, but no 'real' files?
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #9 on: April 26, 2011, 08:21:25 pm »

Yes thats right.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #10 on: April 27, 2011, 10:51:57 am »

Replace the above code with
Code: [Select]
            if ($album['pic_count'] == 0 && $album['link_pic_count'] == 0) {
                continue;
            }
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #11 on: April 27, 2011, 01:58:44 pm »

Then i added the code
if ($album['pic_count'] == 0 && $album['link_pic_count'] == 0) {
                continue;
            }
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #12 on: April 27, 2011, 02:07:18 pm »

Try again
Then i added the code

 if ($album['pic_count'] == 0 && $album['link_pic_count'] == 0) {
                continue;
            }

then the page only became white, nothing at all to see, i thought it could be a missing ( before at the second $album, but no.
More ideas thanks.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #13 on: April 27, 2011, 02:44:50 pm »

Please attach your theme.php file to your next reply.
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #14 on: April 27, 2011, 04:24:01 pm »

Now i partly succeded but the photos shows up in only one column, settings are two columns.
What need to be done?
And new question appeared, is it possible to show the text,
(example, 10 albums even though it are 11 albums) and then it are photos in the 11:th album it show the text 11 in the text below the albums?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #15 on: April 28, 2011, 10:57:46 am »

You accidentally overwrote the
Code: [Select]
$count ++;in both functions. Restore the original functions and re-apply the changes.
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #16 on: April 28, 2011, 11:57:22 am »

Now it are one album that are seåarated from the other ones, see http://galleri.fkljusdal.se new code added.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #17 on: April 28, 2011, 12:10:09 pm »

You have to put the code between
Code: [Select]
foreach($alb_list as $album) {and
Code: [Select]
$count ++;
Logged

palm3ro

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 29
Re: hide empty album/category
« Reply #18 on: April 28, 2011, 02:10:37 pm »

What about my new question, should i start a new subject/question or is it possible to find the answer elsewhere in the forum?

And new question appeared, is it possible to show the text,
(example, 10 albums even though it are 11 albums) and then it are photos in the 11:th album it show the text 11 in the text below the albums?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: hide empty album/category
« Reply #19 on: April 28, 2011, 02:24:56 pm »

10. One question per thread
We have a strict "One question/issue per thread rule", which helps both supporters/moderators to keep track of open/closed issues as well as users who search the board or browse it, looking for answers to their question.

Additionally, I don't understand your question. Search the board before you start a new thread.
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 20 queries.