[Solved]: Title customization help [Solved]: Title customization help
 

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]

Main Menu

[Solved]: Title customization help

Started by fantasyfreak, December 20, 2009, 09:53:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fantasyfreak

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

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

Joachim Müller


fantasyfreak

Of course i tried to search before i asked.

Thanks for suggestions but i solved the task partialy.

I edited displayimage.php

Changes:

pageheader($album_name . '/' . $picture_title, $meta_keywords, false);

TO

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 :)

Joachim Müller

Well, there's a reason why there are several threads that I have refered to. From the third one:
Quote from: Joachim Müller on February 06, 2007, 08:06:14 AM
The page title is being defined in themes/yourtheme/theme.php - find in that filefunction pageheaderIf this line of code exists, edit as suggested below. If it doesn't exist, copy// 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?>of the file themes/yourtheme/theme.php

In above mentioned function definition, find'{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),and replace with'{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.

fantasyfreak