Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: separate input from two attributes in /lang  (Read 211 times)

0 Members and 1 Guest are viewing this topic.

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 150
  • webstar
separate input from two attributes in /lang
« on: November 08, 2018, 01:49:21 am »

Hi all! I am looking to separate these two lines located in the language files by overwriting them in my theme.php:

Code: [Select]
$lang_list_albums['n_pictures'] = '%s files';
$lang_list_albums['last_added'] = ', last one added ';

I am designing my own themes, and I like to have an element with only "% files". The second line can be added under this one below instead, or not at all. (Not important to me)

Code: [Select]
$lang_list_albums['alb_hits'] = 'Album viewed %s times';
I know the recommendation is not to touch any of these files. Therefore I am hoping someone can help me put together a piece for the theme.php that overwrites this segment for me. It is very important to show amount of photos in each album, but not as important to say when last one was added.

Thank you in advance.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1005
Re: separate input from two attributes in /lang
« Reply #1 on: November 08, 2018, 03:17:19 am »

Copy this section from include/theme.inc.php at about line 4398:
Code: [Select]
/******************************************************************************
** Section <<<theme_album_info>>> - START
******************************************************************************/
// Format information which is displayed next to each album
function theme_album_info($pic_count, $link_pic_count, $last_upload_date)
{
    global $CONFIG, $lang_list_albums;

    if ($CONFIG['link_last_upload']) {
        $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . (($CONFIG['link_pic_count'] && $link_pic_count > 0 ) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "") . (($pic_count || ($CONFIG['link_pic_count'] && $link_pic_count > 0 )) ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "");
    } else {
        $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . ($pic_count ? sprintf($lang_list_albums['last_added'], $last_upload_date) : "") . (($CONFIG['link_pic_count'] && $link_pic_count > 0) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "");
    }

    return $album_info;
}
/******************************************************************************
** Section <<<theme_album_info>>> - END
******************************************************************************/

and place it in your theme's theme.php file. Then modify as needed.
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 150
  • webstar
Re: separate input from two attributes in /lang
« Reply #2 on: November 08, 2018, 03:54:01 am »

I tried this:

Code: [Select]
if (!function_exists('theme_album_info')) { //{THEMES}
/******************************************************************************
** Section <<<theme_album_info>>> - START
******************************************************************************/
// Format information which is displayed next to each album
function theme_album_info($pic_count, $link_pic_count, $last_upload_date)
{
    global $CONFIG, $lang_list_albums;

    if ($CONFIG['link_last_upload']) {
        $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . (($CONFIG['link_pic_count'] && $link_pic_count > 0 ) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "") . (($pic_count || ($CONFIG['link_pic_count'] && $link_pic_count > 0 )) ? sprintf($lang_list_albums) : "");
    } else {
        $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . ($pic_count ? sprintf($lang_list_albums) : "") . (($CONFIG['link_pic_count'] && $link_pic_count > 0) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "");
    }

    return $album_info;
}
/******************************************************************************
** Section <<<theme_album_info>>> - END
******************************************************************************/
} //{THEMES}
//EOF

Am I missing something? I erased the last added stuff in there.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1005
Re: separate input from two attributes in /lang
« Reply #3 on: November 08, 2018, 05:11:42 am »

You added 1 too many lines at the top and the bottom. Look carefully at what I had marked for you to copy.
The lines with all the asterisks are not necessary but help with demarcation.
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 150
  • webstar
Re: Re: separate input from two attributes in /lang
« Reply #4 on: November 08, 2018, 12:59:01 pm »

You added 1 too many lines at the top and the bottom. Look carefully at what I had marked for you to copy.
The lines with all the asterisks are not necessary but help with demarcation.

Yes I added all that, and I tried without it. No reaction still. It still picks up the $lang part about last added.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1005
Re: separate input from two attributes in /lang
« Reply #5 on: November 08, 2018, 02:05:53 pm »

You can't just add it as-is ... you need to make the modifications that you want.

Put this in there:
Code: [Select]
/******************************************************************************
** Section <<<theme_album_info>>> - START
******************************************************************************/
// Format information which is displayed next to each album
function theme_album_info($pic_count, $link_pic_count, $last_upload_date)
{
    global $CONFIG, $lang_list_albums;

    $lang_list_albums['n_pictures'] = '%s files';      // <<=====

       $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . (($CONFIG['link_pic_count'] && $link_pic_count > 0 ) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "");
 
    return $album_info;
}
/******************************************************************************
** Section <<<theme_album_info>>> - END
******************************************************************************/
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 150
  • webstar
Re: Re: separate input from two attributes in /lang
« Reply #6 on: November 08, 2018, 04:47:43 pm »

You can't just add it as-is ... you need to make the modifications that you want.

Put this in there:
Code: [Select]
/******************************************************************************
** Section <<<theme_album_info>>> - START
******************************************************************************/
// Format information which is displayed next to each album
function theme_album_info($pic_count, $link_pic_count, $last_upload_date)
{
    global $CONFIG, $lang_list_albums;

    $lang_list_albums['n_pictures'] = '%s files';      // <<=====

       $album_info = sprintf($lang_list_albums['n_pictures'], $pic_count) . (($CONFIG['link_pic_count'] && $link_pic_count > 0 ) ? sprintf(", {$lang_list_albums['n_link_pictures']}, {$lang_list_albums['total_pictures']}", $link_pic_count, $pic_count + $link_pic_count) : "");
 
    return $album_info;
}
/******************************************************************************
** Section <<<theme_album_info>>> - END
******************************************************************************/

Yes, but adding this results now in blank page...
Logged

Hanna.

  • Coppermine frequent poster
  • ***
  • Country: us
  • Offline Offline
  • Gender: Female
  • Posts: 150
  • webstar
Re: separate input from two attributes in /lang
« Reply #7 on: November 08, 2018, 04:49:38 pm »

Attaching the theme file.
Logged

ron4mac

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 1005
Re: separate input from two attributes in /lang
« Reply #8 on: November 08, 2018, 06:09:04 pm »

It fails because that function is already in your theme.php (at line 420).  Remove that one ... or change it there, then remove the bottom one.

P.S. If you're going to override theme functions in your theme.php, don't include with the section the lines marked with //{THEMES} at the start and end of the section.
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.