forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: kingspice on August 29, 2012, 05:30:33 pm

Title: Where is $section variable set
Post by: kingspice on August 29, 2012, 05:30:33 pm
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
Title: Re: Where is $section variable set
Post by: Jeff Bailey on August 29, 2012, 09:32:37 pm
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.
Title: Re: Where is $section variable set
Post by: kingspice on August 31, 2012, 04:10:15 pm
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;
}
Title: Re: Where is $section variable set
Post by: Jeff Bailey on August 31, 2012, 11:41:13 pm
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
Code: [Select]
pageheader('whatever you want for the title');
to and it will display it as the title for you.
Title: Re: Where is $section variable set
Post by: kingspice on September 01, 2012, 12:44:22 am
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
Title: Re: Where is $section variable set
Post by: Jeff Bailey on September 01, 2012, 02:34:03 am
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.
Title: Re: Where is $section variable set
Post by: kingspice on September 02, 2012, 01:35:44 am
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 :)
Title: Re: Where is $section variable set
Post by: Jeff Bailey on September 02, 2012, 02:59:27 am
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?
Title: Re: Where is $section variable set
Post by: kingspice on September 02, 2012, 04:19:05 pm
Yep exactly - the dynamic title.

I am displaying the seperate php file using {CUSTOM_HEADER}
Title: Re: Where is $section variable set
Post by: Jeff Bailey on September 02, 2012, 06:51:20 pm
Something like this should work.

add to your custom theme.php
Code: [Select]
/******************************************************************************
** 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
Code: [Select]
global $custom_title;
echo $custom_title;
Title: Re: Where is $section variable set
Post by: kingspice on September 02, 2012, 07:20:36 pm
Perfect - thanks for the help!