Cat display organisation Cat display organisation
 

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

Cat display organisation

Started by Titooy, April 06, 2005, 11:32:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Titooy

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 ;-)

Joachim Müller

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

donnoman

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.

donnoman

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

Joachim Müller

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".

Titooy

Quote from: donnoman 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.

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