Advanced search  

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

Pages: [1]   Go Down

Author Topic: [Solved]: How to create {OWN_MENU}  (Read 3089 times)

0 Members and 1 Guest are viewing this topic.

mitring

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
[Solved]: How to create {OWN_MENU}
« on: March 09, 2009, 11:04:40 am »

Hi how to create {OWN_MENU}

In template.html I write this:
Code: [Select]
{PAPAVERO_MENU}
But in theme.php I can't find place to create my html template :(

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,
        
'{PAPAVERO_MENU}' => theme_main_menu('template_papavero_menu'), // this's my menu :|
        
);

    echo 
template_eval($template_header$template_vars);
}

function 
theme_main_menu($which)
{
    global 
$AUTHORIZED$CONFIG$album$actual_cat$cat$REFERER;
    global 
$lang_main_menu$template_sys_menu$template_sub_menu$template_papavero_menu// <-- VAR
...
}
« Last Edit: March 10, 2009, 10:13:29 am by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to create {OWN_MENU}
« Reply #1 on: March 10, 2009, 09:52:48 am »

So what? You never populate the variable $template_papavero_menu, nor does the PHP command global do anything particularly usefull in this aspect. The code you posted is just wishfull thinking.

The code in theme.php should look like this instead:
Code: [Select]
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']);
    $papavero_menu = <<< EOT
    <!-- BEGIN Custom Menu -->
    <a href="http://example.com">Menu item # 1</a>
    <a href="foo.html">Menu item # 2</a>
    <a href="bar.html">Menu item # 3</a>
    <!-- END Custom Menu -->
EOT;

    $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,
        '{PAPAVERO_MENU}' => $papavero_menu,
        );

    echo template_eval($template_header, $template_vars);
}

Alternatively, if your custom menu resides in an include file of it's own, use this code:
Code: [Select]
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']);
    $papavero_menu = cpg_get_custom_include('path/to/your/custom/include/file.php');

    $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,
        '{PAPAVERO_MENU}' => $papavero_menu,
        );

    echo template_eval($template_header, $template_vars);
}

Third alternative to explain the concept:
Code: [Select]
$papavero_menu = <<< EOT
<!-- BEGIN Custom Menu -->
<a href="http://example.com">Menu item # 1</a>
<a href="foo.html">Menu item # 2</a>
<a href="bar.html">Menu item # 3</a>
<!-- END Custom Menu -->
EOT;

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;
    global $papavero_menu;

    $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,
        '{PAPAVERO_MENU}' => $papavero_menu,
        );

    echo template_eval($template_header, $template_vars);
}
Logged

mitring

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: How to create {OWN_MENU}
« Reply #2 on: March 10, 2009, 10:04:37 am »

Great, thx for help :) [beer]
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 20 queries.