Advanced search  

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]

Pages: [1]   Go Down

Author Topic: [Solved]: Title customization help  (Read 3642 times)

0 Members and 1 Guest are viewing this topic.

fantasyfreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • Fantastic Gallery
[Solved]: Title customization help
« 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.
« Last Edit: December 22, 2009, 04:01:51 pm by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Title customization help
« Reply #1 on: December 21, 2009, 08:16:57 am »

Logged

fantasyfreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • Fantastic Gallery
Re: Title customization help
« Reply #2 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 :)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Title customization help
« Reply #3 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.
Logged

fantasyfreak

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
    • Fantastic Gallery
Re: Title customization help
« Reply #4 on: December 22, 2009, 02:01:55 pm »

You are so patient:) Thanx
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.