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
-
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.
-
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.
-
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
-
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
?>
-
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
-
After som more testing i succeded to hide albums, not the empty ones though, it, what can be wrong?
-
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).
-
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?
-
So the albums that will be hidden incorrectly contain just linked files, but no 'real' files?
-
Yes thats right.
-
Replace the above code with
if ($album['pic_count'] == 0 && $album['link_pic_count'] == 0) {
continue;
}
-
Then i added the code
if ($album['pic_count'] == 0 && $album['link_pic_count'] == 0) {
continue;
}
-
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.
-
Please attach your theme.php file to your next reply.
-
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?
-
You accidentally overwrote the
$count ++;
in both functions. Restore the original functions and re-apply the changes.
-
Now it are one album that are seåarated from the other ones, see http://galleri.fkljusdal.se new code added.
-
You have to put the code between
foreach($alb_list as $album) {
and
$count ++;
-
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?
-
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.