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: Remove Album/File numbers from main page  (Read 3957 times)

0 Members and 1 Guest are viewing this topic.

mndyy

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Remove Album/File numbers from main page
« on: January 17, 2015, 10:08:06 am »

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!
Logged

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: Remove Album/File numbers from main page
« Reply #1 on: January 20, 2015, 10:37:54 pm »

For Andre.
Can you help him with that?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15757
Re: Remove Album/File numbers from main page
« Reply #2 on: January 21, 2015, 09:40:25 pm »

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 ( ?> ):
Code: [Select]
$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');
}
Logged

mndyy

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Remove Album/File numbers from main page
« Reply #3 on: January 24, 2015, 11:26:36 am »

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

allvip

  • Global Moderator
  • Coppermine addict
  • *****
  • Country: 00
  • Offline Offline
  • Posts: 1290
Re: Remove Album/File numbers from main page
« Reply #4 on: January 24, 2015, 01:18:16 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15757
Re: Remove Album/File numbers from main page
« Reply #5 on: January 24, 2015, 01:23:18 pm »

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

mndyy

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Remove Album/File numbers from main page
« Reply #6 on: January 24, 2015, 01:49:42 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15757
Re: Remove Album/File numbers from main page
« Reply #7 on: January 24, 2015, 04:16:04 pm »

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

mndyy

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Remove Album/File numbers from main page
« Reply #8 on: January 25, 2015, 12:40:11 pm »

Oke I've attached it!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15757
Re: Remove Album/File numbers from main page
« Reply #9 on: January 25, 2015, 08:06:05 pm »

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:
Code: [Select]
/******************************************************************************
** 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
******************************************************************************/
Logged

mndyy

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Remove Album/File numbers from main page
« Reply #10 on: January 28, 2015, 02:37:23 pm »

Perfect! Its worked!
Thank you so much!
Logged
Pages: [1]   Go Up
 

Page created in 0.027 seconds with 21 queries.