Where is $section variable set Where is $section variable set
 

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

Where is $section variable set

Started by kingspice, August 29, 2012, 05:30:33 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

kingspice

Hi,
I was wondering in which file is the $section variable set. Its called in several functions e.g.
in theme.php
'{TITLE}' => theme_page_title($section),

Thanks
Gareth

Jeff Bailey

#1
Please explain what you're trying to accomplish. That variable isn't always the same thing and is usually set while calling the pageheader() function.
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

kingspice

I'm trying to echo the same value, that gets set to the title of the page, via theme_page_title, (without the gallery_name), in a seperate included file.

function theme_page_title($section)
{
    global $CONFIG;
    $return = strip_tags(bb_decode($section)) . ' - ' . $CONFIG['gallery_name'];
    return $return;
}

Jeff Bailey

Please post a link.
http://forum.coppermine-gallery.net/index.php/topic,55415.msg270616.html#msg270616

Like I said that value changes, which one would you like to include on the other page?
If you include coppermine code on your included page you can add

pageheader('whatever you want for the title');

to and it will display it as the title for you.
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

kingspice

Gallery is http://www.parishiltonzone.com/pictures (few raunchy pics)
I haven't implemented anything yet so doesn't really help with my question.

I basically want to set my own custom description meta tag on the page with the value in it:
strip_tags(bb_decode($section))
that is set in the function I listed above
theme_page_title($section)

Hope this makes it clearer

Jeff Bailey

I understand what you want but you're not understanding me.

No one can tell you what the value is becuase it changes on every page.

That function doesn't set the value of $section it is set when the function is called.
You'll have to give me specfics about what you want as the title not just that it is the same as that variable.
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

kingspice

I want the name of the coppermine page, that is essentially output in the title, before the name of the coppermine gallery.

For example:
If coppermine root page - "Home"
If album page - The album name
If category page - The category name/path
If picture page - The album name + picture name
If search page - "Search"

Sorry for not giving you a clearer answer sooner - hope that answers you :)

Jeff Bailey

Ok that is clearer, so you want the dynamic title and not some static text.

How are you displaying your separate file? in anycontent? custom header/footer? Is it a separate page entirely?
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

kingspice

Yep exactly - the dynamic title.

I am displaying the seperate php file using {CUSTOM_HEADER}

Jeff Bailey

Something like this should work.

add to your custom theme.php

/******************************************************************************
** Section <<<pageheader>>> - START
******************************************************************************/
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir, $custom_title;

    $custom_title = $section;

    $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}' => theme_page_title($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,
        '{JAVASCRIPT}' => theme_javascript_head(),
        '{MESSAGE_BLOCK}' => theme_display_message_block(),
    );
   
    $template_vars = CPGPluginAPI::filter('theme_pageheader_params', $template_vars);
    echo template_eval($template_header, $template_vars);

    // Show various admin messages
    adminmessages();
}
/******************************************************************************
** Section <<<pageheader>>> - END
******************************************************************************/


In your include file add

global $custom_title;
echo $custom_title;
Thinking is the hardest work there is, which is probably the reason why so few engage in it. - Henry Ford

kingspice