Support > cpg1.6 themes (visuals)

separate input from two attributes in /lang

(1/2) > >>

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


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

--- End code ---

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: ---$lang_list_albums['alb_hits'] = 'Album viewed %s times';
--- End code ---

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.

ron4mac:
Copy this section from include/theme.inc.php at about line 4398:

--- Code: ---/******************************************************************************
** 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
******************************************************************************/

--- End code ---

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

Hanna.:
I tried this:


--- Code: ---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
--- End code ---

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

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

Hanna.:

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

--- End quote ---

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

Navigation

[0] Message Index

[#] Next page

Go to full version