hide empty album/category hide empty album/category
 

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

hide empty album/category

Started by palm3ro, April 12, 2011, 10:24:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

palm3ro

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.

Αndré

To hide empty categories, copy the function theme_display_cat_list to your theme.php file if it doesn't exist. Then, comment out
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
foreach($alb_list as $album) {
and below, add
            if ($album['pic_count'] == 0) {
                continue;
            }

in both functions.

palm3ro

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

Αndré

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?>

palm3ro

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

palm3ro

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

Αndré

Quote from: palm3ro on April 22, 2011, 08:39:52 AM
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.

palm3ro

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?

Αndré

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

palm3ro


Αndré

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

palm3ro

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

palm3ro

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.

Αndré

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

palm3ro

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?

Αndré

You accidentally overwrote the
$count ++;
in both functions. Restore the original functions and re-apply the changes.

palm3ro

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

Αndré

You have to put the code between
foreach($alb_list as $album) {
and
$count ++;

palm3ro

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?

Αndré

Quote from: Joachim Müller on September 28, 2008, 10:28:42 AM
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.