forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: palm3ro on April 12, 2011, 10:24:12 pm

Title: hide empty album/category
Post by: palm3ro 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.
Title: Re: hide empty album/category
Post by: Αndré 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.
Title: Re: hide empty album/category
Post by: palm3ro 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
Title: Re: hide empty album/category
Post by: Αndré 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
?>
Title: Re: hide empty album/category
Post by: palm3ro 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
Title: Re: hide empty album/category
Post by: palm3ro 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?
Title: Re: hide empty album/category
Post by: Αndré 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 (http://forum.coppermine-gallery.net/index.php/topic,72086.msg348769.html#msg348769).
Title: Re: hide empty album/category
Post by: palm3ro 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?
Title: Re: hide empty album/category
Post by: Αndré on April 26, 2011, 08:14:07 pm
So the albums that will be hidden incorrectly contain just linked files, but no 'real' files?
Title: Re: hide empty album/category
Post by: palm3ro on April 26, 2011, 08:21:25 pm
Yes thats right.
Title: Re: hide empty album/category
Post by: Αndré 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;
            }
Title: Re: hide empty album/category
Post by: palm3ro on April 27, 2011, 01:58:44 pm
Then i added the code
if ($album['pic_count'] == 0 && $album['link_pic_count'] == 0) {
                continue;
            }
Title: Re: hide empty album/category
Post by: palm3ro 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.
Title: Re: hide empty album/category
Post by: Αndré on April 27, 2011, 02:44:50 pm
Please attach your theme.php file to your next reply.
Title: Re: hide empty album/category
Post by: palm3ro 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?
Title: Re: hide empty album/category
Post by: Αndré 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.
Title: Re: hide empty album/category
Post by: palm3ro 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.
Title: Re: hide empty album/category
Post by: Αndré 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 ++;
Title: Re: hide empty album/category
Post by: palm3ro 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?
Title: Re: hide empty album/category
Post by: Αndré 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.