Remove Album/File numbers from main page Remove Album/File numbers from main page
 

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]

Main Menu

Remove Album/File numbers from main page

Started by mndyy, January 17, 2015, 10:08:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mndyy

Hello, I like to jump in on this topic: http://forum.coppermine-gallery.net/index.php/topic,77917.0.html

Is there a way to not show the albums & file numbers on the main page, but do show in the other categories?
I tried to delete 

<td class="catrow" align="center">{ALB_COUNT}</td>
                <td class="catrow" align="center">{PIC_COUNT}</td>

It makes the album count and file numbers disappear on the main page (which is exactly what I want) but also in the other categories and I do like to show the album count and file numbers in the other categories.
It wasnt like this before I updated.

I looked all around the forum, but I just can't seem to find the solution. 
Thank you!

allvip


Αndré

This mod is almost as simple as the other "remove album/file number" mods. We just need to add a new template variable which we use for the root category and then check for the current category in theme_display_cat_list to decide which template variable we need to use (I marked those two lines with the comment "// mod").

mndyy, copy the following code to your theme's theme.php file, right before the closing PHP tag ( ?> ):
$template_cat_list_no_cat = <<<EOT
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="100%" align="left">{CATEGORY}</td>
        </tr>
<!-- END header -->
<!-- BEGIN catrow_noalb -->
        <tr>
                <td class="catrow_noalb" colspan="1"><table border="0"><tr><td align="left">{CAT_THUMB}</td><td align="left"><span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
        </tr>
<!-- END catrow_noalb -->
<!-- BEGIN catrow -->
        <tr>
                <td class="catrow" align="left"><table border="0"><tr><td>{CAT_THUMB}</td><td><span class="catlink">{CAT_TITLE}</span>{CAT_DESC}</td></tr></table></td>
        </tr>
        <tr>
            <td class="tableb tableb_alternate" colspan="1">{CAT_ALBUMS}</td>
        </tr>
<!-- END catrow -->
<!-- BEGIN footer -->
        <tr>
                <td colspan="1" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->
<!-- BEGIN spacer -->
        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />
<!-- END spacer -->

EOT;

function theme_display_cat_list($breadcrumb, &$cat_data, $statistics)
{
    global $template_cat_list, $lang_cat_list;
    global $cat, $template_cat_list_no_cat; // mod
    if (!$cat) $template_cat_list = $template_cat_list_no_cat; // mod
    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_noalb = 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],
            );
            echo template_eval($template_noalb, $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}' => cpg_float2decimal($category[2]),
                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
            );
            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}' => cpg_float2decimal($category[2]),
                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
            );
            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');
}

mndyy

Thank you for the anwser!

But I don't understand. I've copied the code and paste it. But what do I have to do where you marked //mod??
Because now I get an error.

Fatal error: Cannot redeclare theme_display_cat_list() (previously declared in /home/kourtney/public_html/test/themes/10kBeats_Kourtney/theme.php:2537) in /home/kourtney/public_html/test/themes/10kBeats_Kourtney/theme.php on line 4512

I'm not at all familiar with this kind of codes.. 

allvip

The code posted by Andre has function theme_display_cat_list edited to fit your request.
Cannot redeclare theme_display_cat_list() - you have it twice in your theme.php.

Delete function theme_display_cat_list from your theme.php as it is already included in Andre's code.

Αndré

If that function already exists in your theme.php file, you need to modify it as I did (the 2 lines I marked with //mod) instead of copying the already modified function.

mndyy

Okay, got it! and it deleted it on the main page. Thank you.
BUT.. now I get this when I go to a categorie:

Template error
Failed to find block 'catrow_noalb' (#<!-- BEGIN catrow_noalb -->(.*?)<!-- END catrow_noalb -->#s) in :
<!-- BEGIN header -->
        <tr>
                <td class="tableh1" width="80%" align="left">{CATEGORY}</td>
                <td class="tableh1" width="10%" align="center">{ALBUMS}</td>
                <td class="tableh1" width="10%" align="center">{PICTURES}</td>
        </tr>
<!-- END header -->


<!-- BEGIN footer -->
        <tr>
                <td colspan="3" class="tableh1" align="center"><span class="statlink">{STATISTICS}</span></td>
        </tr>
<!-- END footer -->

Do I have to delete it to?? I tried.. but it didn't work..

Αndré

Please attach your whole theme.php file as zip file to your next reply.

mndyy


Αndré

Unfortunately you haven't deleted the whole function as allvip suggested, but have just deleted the function name, which probably causes the issue. Please delete the following code from your theme.php file and try again:
/******************************************************************************
** Section <<<theme_display_cat_list>>> - START
******************************************************************************/

{
    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_noalb = 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],
            );
            echo template_eval($template_noalb, $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}' => cpg_float2decimal($category[2]),
                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
            );
            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}' => cpg_float2decimal($category[2]),
                    '{PIC_COUNT}' => cpg_float2decimal($category[3]),
            );
            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');
}
/******************************************************************************
** Section <<<theme_display_cat_list>>> - END
******************************************************************************/

mndyy