Getting string from {Title} tag Getting string from {Title} tag
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Getting string from {Title} tag

Started by TimGladieux, May 15, 2009, 02:04:13 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TimGladieux

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

Joachim Müller

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

TimGladieux

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

Joachim Müller

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// 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:// 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);
}