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: Cat display organisation  (Read 3515 times)

0 Members and 1 Guest are viewing this topic.

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Cat display organisation
« on: April 06, 2005, 11:32:34 pm »

This is not really a bug in the technical sense of the word but I've always found strange the organisation of the cat display in the classic theme, where 2 categories of the same level appear differently if they have albums or just subcategories. Actually the problem is that the only thing that makes the difference between 2 categories is the fact that there is an album directly in it or not. In my example, there's a difference between 2.1 and 2.2 when there should rather be a difference between 2 and 2.1 (in my mind anyway).

There are some really slight modifications to make it possible:

Open /index.php
in the get_subcat_data function, find

                if ($pic_count == 0 && $album_count == 0) {
                                        $user_thumb = $ident;
                    $cat_data[] = array($link, $subcat['description'], 'cat_thumb' => $user_thumb);
                } else {
                    // Check if you need to show subcat_level
                    if ($level == $CONFIG['subcat_level']) {
                        $cat_albums = list_cat_albums($subcat['cid']);
                    } else {
                        $cat_albums = '';
                    }
                    $cat_data[] = array($link, $subcat['description'], $album_count, $pic_count, 'cat_albums' => $cat_albums, 'cat_thumb' => $user_thumb);
                }
            }

            if ($level > 1) {
                                get_subcat_data($subcat['cid'], $cat_data, $album_set_array, $level -1, $ident . "</td><td><img src=\"images/spacer.gif\" width=\"20\" height=\"1\" border=\"0\" alt=\"\" /></td><td>");
                        }

change into
                if ($pic_count == 0 && $album_count == 0) {
                                        $user_thumb = $ident;
                    $cat_data[] = array($link, $subcat['description'], 'cat_thumb' => $user_thumb, 'level' => $level);
                } else {
                    // Check if you need to show subcat_level
                    if ($level == 1) {
                        $cat_albums = list_cat_albums($subcat['cid']);
                    } else {
                        $cat_albums = '';
                    }
                    $cat_data[] = array($link, $subcat['description'], $album_count, $pic_count, 'cat_albums' => $cat_albums, 'cat_thumb' => $user_thumb, 'level' => $level);
                }
            }

            if ($level < $CONFIG['subcat_level']) {
                                get_subcat_data($subcat['cid'], $cat_data, $album_set_array, $level +1, $ident . "</td><td><img src=\"images/spacer.gif\" width=\"20\" height=\"1\" border=\"0\" alt=\"\" /></td><td>");
                        }


in the get_cat_list function, find

    get_subcat_data($cat, $cat_data, $album_set_array, $CONFIG['subcat_level']);
change into
    get_subcat_data($cat, $cat_data, $album_set_array, 1);



Open /include/themes.inc.php and /themes/classic/theme.php
in the theme_display_cat_list function, find

        if (count($category) == 3) {
change into
        if (count($category) == 4) {




Now it would allow to make something like

        if (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],
                '{LEVEL}' => $category[level],
                );
            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],
                '{LEVEL}' => $category[level],
               );
            echo template_eval($template, $params);
        }

and use it like
<!-- BEGIN catrow -->
        <tr>
                <td class="catrow{LEVEL}" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink"><b>{CAT_TITLE}</b></span>{CAT_DESC}</td></tr></table></td>
                <td class="catrow{LEVEL}" align="center">{ALB_COUNT}</td>
                <td class="catrow{LEVEL}" align="center">{PIC_COUNT}</td>
        </tr>
        <tr>
            <td class="tableb" colspan="3">{CAT_ALBUMS}</td>
        </tr>
<!-- END catrow -->

which would also allow to get rid of the $ident and make the indentation with CSS...

I hope I wasn't too confusing ;-)
« Last Edit: August 15, 2005, 06:50:36 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Cat display organisation
« Reply #1 on: July 31, 2005, 12:16:09 pm »

[moderation]
bumping this unresolved thread to the top...
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Cat display organisation
« Reply #2 on: August 09, 2005, 04:04:59 am »

I'm not really liking this solution because it would require adding a considerable number of entries to css (accross the board), and it's not very scalable.

The config options allow the display depth to be anything.  How many levels are you going to manually add to CSS?

This solution while inventive, shouldn't be used.  I hate saying no, then not offering an alternative, but since it's been bumped, I vote for it to remain status quo until we come up with a better solution.
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray
Re: Cat display organisation
« Reply #3 on: August 09, 2005, 04:49:10 am »

If it were css instead of table based then you could use nested divs of the same class with a left padding. You would only need a single CSS class, and it automatically scales to N levels.

This article explains better: http://builder.com.com/5100-6371_14-5810696.html
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Cat display organisation
« Reply #4 on: August 15, 2005, 06:50:16 am »

let's move this thread to feature requests then, so it doesn't get forgotten. Moving from "CPG 1.4 Testing/Bugs", marking it as "valid".
Logged

Titooy

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Posts: 736
    • under construction...
Re: Cat display organisation
« Reply #5 on: August 15, 2005, 12:49:18 pm »

I'm not really liking this solution because it would require adding a considerable number of entries to css (accross the board), and it's not very scalable.

It wouldn't require adding anything since you can use the current system with just changing 1 character ("3" into "4") in the current themes. People who don't want to use that system just leave it that way.

It just opens new possibilities in designing themes...
Logged
Pages: [1]   Go Up
 

Page created in 0.038 seconds with 19 queries.