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: Getting string from {Title} tag  (Read 2860 times)

0 Members and 1 Guest are viewing this topic.

TimGladieux

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Getting string from {Title} tag
« on: May 15, 2009, 02:04:13 am »

I am creating my own access logs and site analytics with php. In my pages the variable is $pagetitle which is inserted with ...php echo $pagetitle; ?> in my templates outside of coopermine. I have already put my own include in your "custom header" section but...since coopermine creates it's own title string
what is or where is the specific variable that contains that string?

I just want to get the coopmine title string into my php include so each time a coopermine page is called I can have the specific page title for my log. Granted I am already geting the URI but when the page is the index the URI is / which is the same as the URI of any index.php
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Getting string from {Title} tag
« Reply #1 on: May 18, 2009, 09:37:05 pm »

Depends on the coppermine page. Take a look at the pageheader function and how it get's populated on the index and thumbnail page.
Logged

TimGladieux

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Getting string from {Title} tag
« Reply #2 on: May 19, 2009, 01:44:44 am »

Okay, but where in all those files is that function?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Getting string from {Title} tag
« Reply #3 on: May 19, 2009, 09:00:47 am »

Did you try your operating system's search function? Search term would be function pageheader...
Anyway, the function definition resides in themes/yourtheme/theme.php if you have a custom one. The default one is
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);
}
- copy that code from themes/sample/theme.php into themes/yourtheme/theme.php and edit as you see fit. However, I didn't suggest to edit that function - I asked you to take a look at how it get's populated, i.e. what parameters it receives in index.php and thumbnails.php. You find those files in Coppermine's root folder - the function calls exist once in those files. I forgot to mention: another file to look at would be displayimage.php

Anyway, if you just want to grab the content of the title tag and use it somewhere else, you'll need to edit the function definition of the pageheader function inside themes/yourtheme/theme.php. This is what I'd do:
Code: [Select]
// Function for writing a pageheader
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir, $TITLE_TAG;

    $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();
    $TITLE_TAG = $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section));

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $TITLE_TAG,
        '{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);
}
Logged
Pages: [1]   Go Up
 

Page created in 0.029 seconds with 19 queries.