forum.coppermine-gallery.net

Support => cpg1.6.x Support => cpg1.6 themes (visuals) => Topic started by: Hanna. on November 08, 2018, 01:49:21 am

Title: separate input from two attributes in /lang
Post by: Hanna. 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.
Title: Re: separate input from two attributes in /lang
Post by: ron4mac 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.
Title: Re: separate input from two attributes in /lang
Post by: Hanna. 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.
Title: Re: separate input from two attributes in /lang
Post by: ron4mac 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.
Title: Re: Re: separate input from two attributes in /lang
Post by: Hanna. 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.
Title: Re: separate input from two attributes in /lang
Post by: ron4mac 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
******************************************************************************/
Title: Re: Re: separate input from two attributes in /lang
Post by: Hanna. 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...
Title: Re: separate input from two attributes in /lang
Post by: Hanna. on November 08, 2018, 04:49:38 pm
Attaching the theme file.
Title: Re: separate input from two attributes in /lang
Post by: ron4mac 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.
Title: Re: separate input from two attributes in /lang
Post by: Hanna. on November 17, 2019, 08:24:52 pm
I came back to look at this solution. I've been using the pic count alone since we discussed this last.

However, the topic was started to separate the two of these officially by giving the last-updated another {} as supposed to pic count - how would that look like?

I'm looking to move the last updated by itself above album title, so I need it by itself.