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: Hiding Empty Categories (Private Categories)  (Read 2374 times)

0 Members and 1 Guest are viewing this topic.

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Hiding Empty Categories (Private Categories)
« on: March 03, 2007, 02:51:24 am »

I've done some searching but all I've found is that it's not possible/featured.

Basically what I see is that categories are not being hidden if they are empty.  They would be empty, for example, if none of the albums in it are visible.

What DOES work at the moment is the album count.  So I'm thinking if Category's album count is 0, it would not show up in the index.

I don't mind doing the work myself to add this in, nor do I need it featured in config file.  I just need to know what file/function to edit though.  Could someone please point me in the right direction?

What function determines the number of albums in a category and what is the function that lists the categories? (Also what file they're in)

Thanks!
« Last Edit: March 03, 2007, 06:10:45 pm by GauGau »
Logged

Nibbler

  • Guest
Re: Hiding Empty Categories (Private Categories)
« Reply #1 on: March 03, 2007, 03:22:37 am »

Look at the get_cat_list() album in index.php
Logged

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Re: Hiding Empty Categories (Private Categories)
« Reply #2 on: March 03, 2007, 03:43:28 am »

I don't think that's quite it... I'm looking for where the gallery actually goes through and echos the information.

I think it might be this one: theme_display_cat_list

Where is that located?
Logged

Nibbler

  • Guest
Re: Hiding Empty Categories (Private Categories)
« Reply #3 on: March 03, 2007, 03:51:30 am »

It's defined in a theme's theme.php. If it is not defined it falls back to the definition in themes.inc.php
Logged

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Re: Hiding Empty Categories (Private Categories)
« Reply #4 on: March 03, 2007, 03:54:13 am »

Ah okay thanks. :)
Logged

pftq

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 111
Re: Hiding Empty Categories (Private Categories)
« Reply #5 on: March 03, 2007, 04:17:16 am »

Got it.

For those interested, add this function to the themes.php in your Theme:

Code: [Select]
function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
    global $template_cat_list, $lang_cat_list;
    if (count($cat_data) > 0) {
        starttable('100%');
        $template = template_extract_block($template_cat_list, 'header');
        $params = array('{CATEGORY}' => $lang_cat_list['category'],
            '{ALBUMS}' => $lang_cat_list['albums'],
            '{PICTURES}' => $lang_cat_list['pictures'],
            );
        echo template_eval($template, $params);
    }

    $template_noabl = template_extract_block($template_cat_list, 'catrow_noalb');
    $template = template_extract_block($template_cat_list, 'catrow');
    foreach($cat_data as $category) {
        if (!isset($category['cat_thumb'])) { $category['cat_thumb'] = ''; }
        if (count($category) == 3) {
            $params = array('{CAT_TITLE}' => $category[0],
                    '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1]
                );
            if($category[3]>0) echo template_eval($template_noabl, $params);
        } elseif (isset($category['cat_albums']) && ($category['cat_albums'] != '')) {
            $params = array('{CAT_TITLE}' => $category[0],
                '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1],
                '{CAT_ALBUMS}' => $category['cat_albums'],
                '{ALB_COUNT}' => $category[2],
                '{PIC_COUNT}' => $category[3],
                );
            if($category[3]>0) echo template_eval($template, $params);
        } else {
            $params = array('{CAT_TITLE}' => $category[0],
                '{CAT_THUMB}' => $category['cat_thumb'],
                '{CAT_DESC}' => $category[1],
                '{CAT_ALBUMS}' => '',
                '{ALB_COUNT}' => $category[2],
                '{PIC_COUNT}' => $category[3],
                );
            if($category[3]>0) echo template_eval($template, $params);
        }
    }

    if ($statistics && count($cat_data) > 0) {
        $template = template_extract_block($template_cat_list, 'footer');
        $params = array('{STATISTICS}' => $statistics);
        echo template_eval($template, $params);
    }


    if (count($cat_data) > 0)
          endtable();
        echo template_extract_block($template_cat_list, 'spacer');
}

Basically, in foreach($cat_data as $category) {...}, add if($category[3]>0) before each echo template_eval
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.