forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: fantasyfreak on December 20, 2009, 09:53:07 pm

Title: [Solved]: Title customization help
Post by: fantasyfreak on December 20, 2009, 09:53:07 pm
Hello everybody,

Can anybody explain me how to change title tag for pictures in gallery?

Current title looks like this: Site name - Album name/Picture name

I guess many titles will not be visible in search engines results so i want to have it this way:

Picture name - Album name - Site name

I tried to locate proper code but i am not sure.

What i found is this code in displayimage.php

Code: [Select]
   $picture_title = $CURRENT_PIC_DATA['title'] ? $CURRENT_PIC_DATA['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($CURRENT_PIC_DATA['filename'])), "_", " ");
But i am not sure how to customize it and if this code is enough.

Coppermine version: 1.4.25
My gallery link: http://fantasticgallery.com/
Theme: Avalon

Thank you very much.
Title: Re: Title customization help
Post by: Joachim Müller on December 21, 2009, 08:16:57 am
...and various other threads...
Title: Re: Title customization help
Post by: fantasyfreak on December 21, 2009, 01:25:43 pm
Of course i tried to search before i asked.

Thanks for suggestions but i solved the task partialy.

I edited displayimage.php

Changes:

Code: [Select]
pageheader($album_name . '/' . $picture_title, $meta_keywords, false);
TO

Code: [Select]
pageheader($picture_title . ' | ' . $album_name, $meta_keywords, false);
result is Site Name - Picture name | Album name

This is still not exactly i need. I checked index.php as you suggested but i am able to locate code where can i add sitename to end of title.

I need it this way:

Picture name | Album Name | Site Name

I understand it needs tons of patience to be admin here but pls help :)
Title: Re: Title customization help
Post by: Joachim Müller on December 22, 2009, 01:06:39 pm
Well, there's a reason why there are several threads that I have refered to. From the third one:
The page title is being defined in themes/yourtheme/theme.php - find in that file
Code: [Select]
function pageheaderIf this line of code exists, edit as suggested below. If it doesn't exist, copy
Code: [Select]
// Function for writing a pageheader
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

        $charset = ($CONFIG['charset'] == 'language file') ? $lang_charset : $CONFIG['charset'];

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
        header("Content-Type: text/html; charset=$charset");
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $charset,
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        );

    echo template_eval($template_header, $template_vars);
}
from themes/sample/theme.php into a new line before
Code: [Select]
?>of the file themes/yourtheme/theme.php

In above mentioned function definition, find
Code: [Select]
'{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),and replace with
Code: [Select]
'{TITLE}' => strip_tags(bb_decode($section)),.
Save the file, upload it to your webserver and you're done.
Please read all threads that I have refered to carefully.
Title: Re: Title customization help
Post by: fantasyfreak on December 22, 2009, 02:01:55 pm
You are so patient:) Thanx