forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: aibonlengket on December 17, 2005, 12:46:18 pm

Title: How do I remove a button from the menu?
Post by: aibonlengket on December 17, 2005, 12:46:18 pm
I hope I got the right place to ask this.

I have mambo 4.5.2.3 with cpg 1.4.2 integrated beautifully. I have it wraped in mambo. What I want to do is to erase the login/logout including the link in the cpg. It's in the {SYS_MENU} I think, if we are refering to the template. I did a hack in the /lang/english.php on line 128-131 to ignore it. It work, but when I log in there's a name of the user that have a link to take you to logut. because I have it wrapped in mambo, the frame takes you directly to the home page mambo; but still wrapped in the main mambo. can anybody help me please...
Title: Re: HELP PLEASE on erasing LOGIN/LOGOUT
Post by: Joachim Müller on December 19, 2005, 08:08:37 am
to edit a menu (or anything else), take a look at themes/sample/theme.php, find the menu section, copy it over to the theme you're actually using (themes/yourtheme/theme.php). Then edit the menu accordingly (comment the login link out, don't remove it). Another option would be to add a target attribute to the <a href> tag.
Title: Re: HELP PLEASE on erasing LOGIN/LOGOUT
Post by: aibonlengket on December 20, 2005, 05:16:53 am
Thanks GuGu. I got it to work. here's what I did. I copy everything in the /sample/theme.php to my theme /blackbirch/theme.php. edit the  /blackbirch/theme.php

from
   addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
   addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');

to
 addbutton($sys_menu_buttons,'','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
 addbutton($sys_menu_buttons,'','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');

is this what you ment by comment it out? and another thing is do you have to copy everything from the /sample/theme.php? because I saw on the other theme.php they just copy what was need. I tried to do that but I failed. I guess I don't understand what needed and whats not. can you give me a clue? Thanks for the fast reply.

oh one more thing. where do you put the <a href> tag? in the theme.php and replace {LOGIN_LNK}?
Title: Re: HELP PLEASE on erasing LOGIN/LOGOUT
Post by: Joachim Müller on December 20, 2005, 09:00:14 am
you comment out stuff in php by putting two slashes in front of the code. To get rid of the login link, find
Code: [Select]
addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');and replace with
Code: [Select]
// addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');You're not meant to copy everything from the sample theme, but only the stuff you want changed.
Title: How do I remove the Login button from the menu?
Post by: tgontz on December 21, 2005, 08:53:32 pm
How do I remove the Login button from the menu? I have tried commenting it out, but depending on how I do the commenting out, my gallery will will either not load at all or I get the following error in Internet Explorer:

Template error
Failed to find block 'login'(#(<!-- BEGIN login -->)(.*?)(<!-- END login -->)#s) in :

I was successfully able to comment out some of the other menu items, but not the Login.

My gallery is located at is http://www.gontzphotography.com/gallery/index.php (http://www.gontzphotography.com/gallery/index.php)

I am using a custom theme I named classic_paypal and copied and pasted the menu code from the sample theme.

Thanks in advance!
Title: Re: How do I remove the Login button from the menu?
Post by: artistsinhawaii on December 21, 2005, 09:08:38 pm
comment out what is BETWEEN the BEGIN and END markers.. do not comment out the markers themselves.

Quote
<!-- BEGIN login -->

// (.*?)        <!-- comment out what is here between the two markers -->

<!-- END login -->)


Dennis
Title: Re: How do I remove the Login button from the menu?
Post by: tgontz on December 21, 2005, 09:52:16 pm
I am using 1.4.2 and do not have the markers. Am I looking in the wrong place?

This is what I have:

// HTML template for template sys_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
   
    addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.
Title: Re: How do I remove the Login button from the menu?
Post by: artistsinhawaii on December 21, 2005, 10:16:31 pm
OOps, sorry, I always do it using the old menu layout.
Don't know if this will work, but try blocking out the login/logout options and add

<!-- BEGIN login -->
<!-- END login -->)
 

just above     // Login and Logout don't have a spacer as only one is shown, and either would be the last option.

Dennis
Title: Re: How do I remove the Login button from the menu?
Post by: tgontz on December 21, 2005, 11:43:14 pm
I got it now. I simply put // in front of the addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');

(Which I thought that I tried before and it wasn't working - I must have also been doing something else different!)

Also, by the way, when I tried to use any html comment tags <!-- --> my gallery would not load at all. I would just get a blank white browser window.

Thanks for the suggestions!
Title: Re: How do I remove the Login button from the menu?
Post by: tgontz on December 22, 2005, 02:42:11 pm
Well I thought that I had this issue resolved. However, I just went to log in to my gallery and I got the following error:

Template error
Failed to find block 'login'(#(<!-- BEGIN login -->)(.*?)(<!-- END login -->)#s) in :
            <!-- BEGIN home -->
        <a href="{HOME_TGT}" title="{HOME_TITLE}">Gallery Home</a> ::
  <!-- END home -->  <!-- BEGIN my_gallery -->
        <a href="{MY_GAL_TGT}" title="{MY_GAL_TITLE}">{MY_GAL_LNK}</a> ::
  <!-- END my_gallery -->  <!-- BEGIN allow_memberlist -->
        <a href="{MEMBERLIST_TGT}" title="{MEMBERLIST_TITLE}">{MEMBERLIST_LNK}</a> ::
  <!-- END allow_memberlist -->  <!-- BEGIN my_profile -->
        <a href="{MY_PROF_TGT}" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a> ::
  <!-- END my_profile -->  <!-- BEGIN enter_admin_mode -->
        <a href="{ADM_MODE_TGT}" title="{ADM_MODE_TITLE}">{ADM_MODE_LNK}</a> ::
  <!-- END enter_admin_mode -->  <!-- BEGIN leave_admin_mode -->
        <a href="{USR_MODE_TGT}" title="{USR_MODE_TITLE}">{USR_MODE_LNK}</a> ::
  <!-- END leave_admin_mode -->  <!-- BEGIN upload_pic -->
        <a href="{UPL_PIC_TGT}" title="{UPL_PIC_TITLE}">{UPL_PIC_LNK}</a> ::
  <!-- END upload_pic -->  <!-- BEGIN register -->
        <a href="{REGISTER_TGT}" title="{REGISTER_TITLE}">{REGISTER_LNK}</a> ::
  <!-- END register -->  <!-- BEGIN faq -->
        <a href="{FAQ_TGT}" title="{FAQ_TITLE}">{FAQ_LNK}</a> ::
  <!-- END faq -->  <!-- BEGIN logout -->
        <a href="{LOGOUT_TGT}" title="{LOGOUT_TITLE}">{LOGOUT_LNK}</a>
  <!-- END logout -->







This is what my theme.php file looks like:



<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.2
  $Source: /cvsroot/coppermine/devel/themes/classic/theme.php,v $
  $Revision: 1.71 $
  $Author: gaugau $
  $Date: 2005/10/25 01:16:24 $
**********************************************/

// ------------------------------------------------------------------------- //
// This theme has all CORE items removed                                     //
// ------------------------------------------------------------------------- //
define('THEME_IS_XHTML10_TRANSITIONAL',1);

// Creates an array of tokens to be used with function assemble_template_buttons
// this function is used in this file it needs to be declared before being called.
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer) {
  $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer);
}


// HTML template for sys_menu
$template_sys_menu = <<<EOT
          {BUTTONS}
EOT;

// HTML template for sub_menu
$template_sub_menu = $template_sys_menu;


  // HTML template for template sys_menu spacer
  $template_sys_menu_spacer ="::";

  // HTML template for template sys_menu buttons
  $template_sys_menu_button = <<<EOT
  <!-- BEGIN {BLOCK_ID} -->
        <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a> {SPACER}
  <!-- END {BLOCK_ID} -->
EOT;

  // HTML template for template sys_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}

   
    addbutton($sys_menu_buttons,'Gallery Home','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    //addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$template_sys_menu_spacer);
   

    //addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');


    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.




  // HTML template for template sub_menu spacer
  $template_sub_menu_spacer = $template_sys_menu_spacer;

  // HTML template for template sub_menu buttons
  $template_sub_menu_button= $template_sys_menu_button;

  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'Album View','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
/* //Commented out by Trevor
    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
*/

    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');
?>



Any suggestions?
Title: Re: How do I remove the Login button from the menu?
Post by: donnoman on December 22, 2005, 08:59:14 pm
re-enable the items in sys_menu so we don't get template errors; we will strip the login and home links with a plugin
Code: [Select]
   addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);

   addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');


To remove the spacer after the FAQ link edit your buttons and replace the spacer variable.
Code: [Select]
    addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq','');
    addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.

Upload and enable the final_extract plugin.

final_extract codebase.php
Code: [Select]
$thisplugin->add_filter('page_html','final_extract_page_html');

function final_extract_block(&$template, $block_name, $subst='')
{
        $pattern = "#(<!-- BEGIN $block_name -->)(.*?)(<!-- END $block_name -->)#s";
        if ( preg_match($pattern, $template, $matches)){
            $template = str_replace($matches[1].$matches[2].$matches[3], $subst, $template);
            return $matches[2];
        }
}

function final_extract_page_html($html)
{   
    //repeat the next line for each block you would like removed
    final_extract_block($html, 'login');
    final_extract_block($html, 'home');
return $html;
}
Title: Re: How do I remove the Login button from the menu?
Post by: tgontz on December 23, 2005, 04:22:14 pm
I'm not sure exactly what I am supposed to do with the final_extract.zip file. I extracted the this file so that codebase.php and configuration.php are in a final named final_extract on my desktop. I then searched the forum on to install a plugin. I found the following:

"Navigate to the pluginmgr.php page, click browse, locate the plugin you downloaded on your PC and click upload. Once the plugin has beploaded, click on the (i) icon to install it. Follow any setup instructions provided by the plugin's installer."

So I tried this for each file, but I get an error message saying, "The file uploaded is not a plugin package. "

I then tried to upload the zip file and I recieved the following error:"There was an error copying the package to the plugins folder."


What exactly am I to do with the information you posted?

Thank you!
Title: Re: How do I remove the Login button from the menu?
Post by: donnoman on December 23, 2005, 07:13:37 pm
just use regular ftp to upload the final_extract folder to the plugins folder.
Title: Re: How do I remove the Login button from the menu?
Post by: aibonlengket on December 25, 2005, 12:54:01 am
thaks man it work like a charm. now I dont have to hack the template
Title: Re: How do I remove the Login button from the menu?
Post by: tgontz on December 27, 2005, 03:33:14 am
donnoman,

I want to thank you as well! The plugin works great!
Title: Re: How do I remove the Login button from the menu?
Post by: donnoman on December 28, 2005, 07:37:41 am
awesome a twofer!
Title: Re: How do I remove the Login button from the menu?
Post by: Linea on January 02, 2006, 12:01:26 am
I don't want to remove the Login button, but the button "toprated" or "last commented" for example. This should work te same way, shouldn't it? So I copied the section

if (!defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {

  // HTML template for template sub_menu spacer
  $template_sub_menu_spacer = $template_sys_menu_spacer;

  // HTML template for template sub_menu buttons
  $template_sub_menu_button= $template_sys_menu_button;

  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}

into my theme.php, but I get the following error: Fatal error: Call to undefined function: addbutton() in /var/www/vhosts/lalapanzi.de/httpdocs/fotogalerie/themes/galopprennen/theme.php on line 38

Undefined function? I just copied it from .../sample/theme.php. What's wrong with it?
Title: Re: How do I remove the Login button from the menu?
Post by: Tranz on January 02, 2006, 12:08:30 am
It means you need to copy the function over, too.

Code: [Select]
// Creates an array of tokens to be used with function assemble_template_buttons
// this function is used in this file it needs to be declared before being called.
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer) {
  $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer);
}
Title: Re: How do I remove the Login button from the menu?
Post by: Tranz on January 02, 2006, 12:10:37 am
You also needed to copy over this function:
Code: [Select]
// Creates buttons from a template using an array of tokens
// this function is used in this file it needs to be declared before being called.
function assemble_template_buttons($template_buttons,$buttons) {
    $counter=0;
    $output='';

    foreach ($buttons as $button)  {
      if (isset($button[4])) {
         $spacer=$button[4];
      } else {
      $spacer='';
      }

        $params = array(
            '{SPACER}'     => $spacer,
            '{BLOCK_ID}'   => $button[3],
            '{HREF_TGT}'   => $button[2],
            '{HREF_TITLE}' => $button[1],
            '{HREF_LNK}'   => $button[0]
            );
        $output.=template_eval($template_buttons, $params);
    }
    return $output;
}
Title: Re: How do I remove the Login button from the menu?
Post by: Linea on January 02, 2006, 11:48:46 am
Hey TranzNDance, thank you very much for your answer! Everything is a bit complicated in a foreign language. But this support forum is much better than the german one, so I try to find the solution here. :-) I understand what you say...before using "addbutton" I have to define it. OK! I will try after having finished work today.
Title: Re: How do I remove the Login button from the menu?
Post by: Linea on January 03, 2006, 12:53:14 am
It works 50%. I can comment out some features from the SUB_MENU, e.g. "toprated" or "last commented". But I fail when I want to comment out the feature "my gallery" in the SYS_MENU. OK, ist's only a flaw, but I want to understand the system...

At the moment my theme.php looks like this:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2005 Coppermine Dev Team
  v1.1 originaly written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.1
  $Source:
  $Revision: 1.10 $
  $Author:
  $Date: 2005/04/30 07:13:16 $
**********************************************/

define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1); // Remove this if you edit this template until
                                           // you have validated it. See docs/theme.htm.


// Creates buttons from a template using an array of tokens
// this function is used in this file it needs to be declared before being called.
function assemble_template_buttons($template_buttons,$buttons) {
    $counter=0;
    $output='';

    foreach ($buttons as $button)  {
      if (isset($button[4])) {
         $spacer=$button[4];
      } else {
      $spacer='';
      }

        $params = array(
            '{SPACER}'     => $spacer,
            '{BLOCK_ID}'   => $button[3],
            '{HREF_TGT}'   => $button[2],
            '{HREF_TITLE}' => $button[1],
            '{HREF_LNK}'   => $button[0]
            );
        $output.=template_eval($template_buttons, $params);
    }
    return $output;
}


// Creates an array of tokens to be used with function assemble_template_buttons
// this function is used in this file it needs to be declared before being called.
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer) {
  $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer);
}


// HTML template for sys_menu
$template_sys_menu = <<<EOT
          {BUTTONS}
EOT;

// HTML template for sub_menu
$template_sub_menu = $template_sys_menu;

if (!defined('THEME_HAS_NO_SYS_MENU_BUTTONS')) {

  // HTML template for template sys_menu spacer
  $template_sys_menu_spacer ="***";

  // HTML template for template sys_menu buttons
  $template_sys_menu_button = <<<EOT
  <!-- BEGIN {BLOCK_ID} -->
        <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a> {SPACER}
  <!-- END {BLOCK_ID} -->
EOT;

  // HTML template for template sys_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MEMBERLIST_LNK}','{MEMBERLIST_TITLE}','{MEMBERLIST_TGT}','allow_memberlist',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{MY_PROF_LNK}','{MY_PROF_TITLE}','{MY_PROF_TGT}','my_profile',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{ADM_MODE_LNK}','{ADM_MODE_TITLE}','{ADM_MODE_TGT}','enter_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{USR_MODE_LNK}','{USR_MODE_TITLE}','{USR_MODE_TGT}','leave_admin_mode',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{UPL_PIC_LNK}','{UPL_PIC_TITLE}','{UPL_PIC_TGT}','upload_pic',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{REGISTER_LNK}','{REGISTER_TITLE}','{REGISTER_TGT}','register',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{FAQ_LNK}','{FAQ_TITLE}','{FAQ_TGT}','faq',$template_sys_menu_spacer);
   addbutton($sys_menu_buttons,'{LOGIN_LNK}','{LOGIN_TITLE}','{LOGIN_TGT}','login','');
    addbutton($sys_menu_buttons,'{LOGOUT_LNK}','{LOGOUT_TITLE}','{LOGOUT_TGT}','logout','');
   
    // Login and Logout don't have a spacer as only one is shown, and either would be the last option.

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
  $template_sys_menu = template_eval($template_sys_menu,$params);
}

if (!defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {

  // HTML template for template sub_menu spacer
  $template_sub_menu_spacer = $template_sys_menu_spacer;

  // HTML template for template sub_menu buttons
  $template_sub_menu_button= $template_sys_menu_button;

  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
    //addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}


?>
Title: Re: How do I remove the Login button from the menu?
Post by: Linea on January 03, 2006, 02:11:08 am
I give it up. No chance to remove any of the links in the SYS_MENU. I tried the solution with the plugin, but I completely failed. ???

Quote
Upload and enable the final_extract plugin.

I extracted the zip file and upoaded it in the plugins folder. But what exactly do I have to do to ENABLE it??  I can't see any difference between the time before and after the upload.
Title: Re: How do I remove the Login button from the menu?
Post by: Joachim Müller on January 03, 2006, 07:45:22 am
when you need help on a plugin, reply to the thread that deals with it.
Title: Re: How do I remove the Login button from the menu?
Post by: Linea on January 03, 2006, 12:49:16 pm
Didn't I do that? ;-)


Quote
Re: How do I remove the Login button from the menu?
« Reply #10 on: December 22, 2005, 08:59:14 PM »   

--------------------------------------------------------------------------------

re-enable the items in sys_menu so we don't get template errors; we will strip the login and home links with a plugin

I don't mind whether we solve my problem with or without a plugin. I am not interested in HOW to do it, I am interested in THAT we do it. I would be very glad to find a quite simple solution for that!
Title: Re: How do I remove the Login button from the menu?
Post by: donnoman on January 04, 2006, 04:34:09 am
once you dump the plugin into the plugins directory you need to actually turn it on.

Open up your config, one of the uptions is "plugin manager" on the right side.

Find the plugin you want to turn on in the plugin manager and click the "I" for install.

That should do it.
Title: Re: How do I remove the Login button from the menu?
Post by: Linea on January 04, 2006, 11:08:09 am
It works! It really works!! Jippieh!!! Wow, that was not an easy thing to do, but finally we got it!  :D

Thank you very very much for your help, donnoman! 
Title: Re: How do I remove a button from the menu?
Post by: Paver on January 24, 2006, 05:51:50 pm
Here's a thread for the final_extract plugin:
http://forum.coppermine-gallery.net/index.php?topic=26893.0 (http://forum.coppermine-gallery.net/index.php?topic=26893.0).

Please ask questions that only deal with the plugin on that thread.
Title: Re: How do I remove a button from the menu?
Post by: biker-boy on March 03, 2006, 06:36:13 pm
OK FIXED IT ... Sorry I didn't install the plug in.   HA HA .. only wasted 4 days on this  lol

Removing top menu buttons doens't work for me.
I've read this whole thread about 5 times. I've downloaded and installed the lasted version of CPG.
I've now use the sample theme file in my new bikernight theme, just so I don't miss anything out.
I've also enabled plugins and uploaded the file you suggest adding in to it :

function final_extract_page_html($html)
{   
    //repeat the next line for each block you would like removed
    final_extract_block($html, 'home');
        final_extract_block($html, 'my_gallery');
   final_extract_block($html, 'allow_memberlist');
   final_extract_block($html, 'my_profile');
   final_extract_block($html, 'enter_admin_mode');
   final_extract_block($html, 'leave_admin_mode');
   final_extract_block($html, 'register');
   final_extract_block($html, 'album_list');
   final_extract_block($html, 'lastup');
   final_extract_block($html, 'lastcom');
   final_extract_block($html, 'topn');
   final_extract_block($html, 'toprated');
   final_extract_block($html, 'favpics');
   final_extract_block($html, 'search');

      return $html;
}

but NO matter what I do .. I can't remove the  "My Favorites" or "Search link" at the top of each page.
What can it be!  I'm at about to lose the only bit of hair I've left. lol
Please help
ta Matt
Title: Re: How do I remove a button from the menu?
Post by: Paver on March 03, 2006, 07:15:53 pm
A link to your site would be useful.  My guess is that your "My Favorites" and "Search" links are not marked correctly with the block tags 'favpics' and 'search' respectively.  The Coppermine default themes should have these links marked correctly. 

So take a look at your theme.php to see how those 2 links are rendered.  You can paste those lines here if you need assistance.  Final_extract only works when the block is marked by the <!-- BEGIN block --> and <!-- END block --> tags.
Title: Re: How do I remove a button from the menu?
Post by: nontekkyguy on March 05, 2006, 11:03:13 am
I'm using "fruity" theme and I don't want the "MyFavorites" button to appear. I've tried to use the final_extract plugin but that doesn't work. I've also tried to understand the responses above, but I can't seem to find the files mentioned. I've checked my directories for the theme.php file within the themes folder for Fruity. I did however, find theme.inc.php.  Can anyone offer some advice?

This is what I find in theme.php within the fruity theme folder:

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.4
  $Source: /cvsroot/coppermine/stable/themes/fruity/theme.php,v $
  $Revision: 1.16 $
  $Author: gaugau $
  $Date: 2006/02/24 13:32:45 $
**********************************************/

// ------------------------------------------------------------------------- //
// The theme "Fruity" has been done by GauGau (http://gaugau.de/) based on   //
// the framed template of studicasa.nl (their website has gone down, so I    //
// guess no one will care). The usage of this theme is free for personal     //
// use, not for commercial use (according to the disclaimer of studiocasa)!  //
// ------------------------------------------------------------------------- //

define('THEME_HAS_RATING_GRAPHICS', 1);
define('THEME_HAS_NAVBAR_GRAPHICS', 1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);  // Remove this if you edit this template until
                                            // you have validated it. See docs/theme.htm.

// HTML template for main menu
$template_sys_menu = <<<EOT
                <div class="topmenu">
                     {BUTTONS}
                </div>
EOT;

// HTML template for template sys_menu spacer
$template_sys_menu_spacer ='';


?>
Title: Re: How do I remove a button from the menu?
Post by: Fudgemaster on March 05, 2006, 01:44:57 pm
I'm using "fruity" theme and I don't want the "MyFavorites" button to appear. I've tried to use the final_extract plugin but that doesn't work. I've also tried to understand the responses above, but I can't seem to find the files mentioned. I've checked my directories for the theme.php file within the themes folder for Fruity. I did however, find theme.inc.php.  Can anyone offer some advice?

I've edited the themes.inc.php and commented the unnecessary buttons out byt adding // to the start of the line.

Code: [Select]
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'Stats','Statistics','http://www.partanen.net/gallery/stats.php','stats',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'Calendar','Events calendar','http://www.partanen.net/calendar/','calendar',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'RSS','RSS feed of updates','http://www.partanen.net/news.xml','RSS',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');
    } //{THEMES}

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}

Editing this file was if I remember, not suggested, but still this is how I pulled it off.
Title: Re: How do I remove a button from the menu?
Post by: Joachim Müller on March 05, 2006, 01:51:02 pm
you mustn't edit include/themes.inc.php, under no circumstances. Undo your changes there. Instead, edit themes/yourtheme/theme.php in a similar manner.
Title: Re: How do I remove a button from the menu?
Post by: manne on March 16, 2006, 08:19:38 pm
I get this error message:
Quote
Template error
Failed to find block 'custom_link'(#(<!-- BEGIN custom_link -->)(.*?)(<!-- END custom_link -->)#s) in :

When I have added these lines in my theme.php (im trying to remove the favorite link)
Code: [Select]
// manne
// Creates buttons from a template using an array of tokens
// this function is used in this file it needs to be declared before being called.
function assemble_template_buttons($template_buttons,$buttons) {
    $counter=0;
    $output='';

    foreach ($buttons as $button)  {
      if (isset($button[4])) {
         $spacer=$button[4];
      } else {
      $spacer='';
      }

        $params = array(
            '{SPACER}'     => $spacer,
            '{BLOCK_ID}'   => $button[3],
            '{HREF_TGT}'   => $button[2],
            '{HREF_TITLE}' => $button[1],
            '{HREF_LNK}'   => $button[0]
            );
        $output.=template_eval($template_buttons, $params);
    }
    return $output;
}

// manne
// Creates an array of tokens to be used with function assemble_template_buttons
// this function is used in this file it needs to be declared before being called.
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer) {
  $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer);
}

// manne
if (!defined('THEME_HAS_NO_SUB_MENU_BUTTONS')) {

  // HTML template for template sub_menu spacer
  $template_sub_menu_spacer = $template_sys_menu_spacer;

  // HTML template for template sub_menu buttons
  $template_sub_menu_button= $template_sys_menu_button;

  // HTML template for template sub_menu buttons
    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}
    addbutton($sub_menu_buttons,'{CUSTOM_LNK_LNK}','{CUSTOM_LNK_TITLE}','{CUSTOM_LNK_TGT}','custom_link',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{ALB_LIST_LNK}','{ALB_LIST_TITLE}','{ALB_LIST_TGT}','album_list',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTUP_LNK}','{LASTUP_TITLE}','{LASTUP_TGT}','lastup',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{LASTCOM_LNK}','{LASTCOM_TITLE}','{LASTCOM_TGT}','lastcom',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPN_LNK}','{TOPN_TITLE}','{TOPN_TGT}','topn',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{TOPRATED_LNK}','{TOPRATED_TITLE}','{TOPRATED_TGT}','toprated',$template_sub_menu_spacer);
//    addbutton($sub_menu_buttons,'{FAV_LNK}','{FAV_TITLE}','{FAV_TGT}','favpics',$template_sub_menu_spacer);
    addbutton($sub_menu_buttons,'{SEARCH_LNK}','{SEARCH_TITLE}','{SEARCH_TGT}','search','');

  $params = array('{BUTTONS}' => assemble_template_buttons($template_sub_menu_button,$sub_menu_buttons));
  $template_sub_menu = template_eval($template_sub_menu,$params);
}


have I missed something?
Title: Re: How do I remove a button from the menu?
Post by: Joachim Müller on March 16, 2006, 11:49:24 pm
karma taken, thread locked. *sigh*