water drop theme - sys_menu / sub_menu water drop theme - sys_menu / sub_menu
 

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

water drop theme - sys_menu / sub_menu

Started by _Dana_, November 26, 2010, 09:03:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

_Dana_

Hi,

I've been searching high and low in both the docs and the forum for the last few days to figure out where water_drop calls on SYS_MENU and SUB_MENU, as well as the footer. But I have been unable to find an answer (but I'm sure it's been asked before). So where does template.html call those tokens from because theme.php is next to blank (see code below), which they're usually not. Any help would be appreciated.

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2010 Coppermine Dev Team
  v1.0 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 version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.5.8
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/themes/water_drop/theme.php $
  $Revision: 7805 $
**********************************************/

define('THEME_HAS_PROGRESS_GRAPHICS'1);

// HTML template for template sys_menu spacer
$template_sys_menu_spacer '<img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />';

?>


Also, I've tried using "final_plugin" to change things but it isn't cutting it.

Αndré

If a function doesn't exist in theme.php, it will be used from include/themes.inc.php. You can copy functions easily from themes/sample/theme.php to your theme.php file.

_Dana_

Thank you, André! Now I know where I'm supposed to be looking :)

Being not a very avid PHP user, I'm running into a minor problem though, when I've finally found the sys/sub_menu. If I add functions into the "regular" theme.php all I get is an error: "Fatal error: Call to undefined function addbutton() in D:\Inetpub\LocalUser\ftp_pilefood\www\galleri\themes\pilefood2010\theme.php on line 47"

Maybe I added the wrong function or missed defining something (which is my guess considering the error)?

This is what I added in the theme.php for water_drop

/******************************************************************************
** Section <<<$template_sub_menu>>> - START
******************************************************************************/
// 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 = '<img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />';

  // HTML template for template sys_menu buttons

  $template_sys_menu_button = <<<EOT
  <!-- BEGIN {BLOCK_ID} -->
        <a href="{HREF_TGT}" title="{HREF_TITLE}" {HREF_ATTRIBUTES}>{HREF_LNK}</a> {SPACER}
  <!-- END {BLOCK_ID} -->
EOT;

  // HTML template for template sys_menu buttons

    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}{HREF_ATTRIBUTES}
    addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    addbutton($sys_menu_buttons,'{CONTACT_LNK}','{CONTACT_TITLE}','{CONTACT_TGT}','contact',$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);
    if (array_key_exists('allowed_albums', $USER_DATA) && is_array($USER_DATA['allowed_albums']) && count($USER_DATA['allowed_albums'])) {
      addbutton($sys_menu_buttons,'{UPL_APP_LNK}','{UPL_APP_TITLE}','{UPL_APP_TGT}','upload_approval',$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,'{SIDEBAR_LNK}','{SIDEBAR_TITLE}','{SIDEBAR_TGT}','sidebar',$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,'{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.



  $sys_menu_buttons = CPGPluginAPI::filter('sys_menu',$sys_menu_buttons);
  $params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
  $template_sys_menu = template_eval($template_sys_menu,$params);
}
/******************************************************************************
** Section <<<$template_sub_menu>>> - END
******************************************************************************/


So the complete theme.php looks like this now

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2010 Coppermine Dev Team
  v1.0 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 version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.5.8
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.5.x/themes/water_drop/theme.php $
  $Revision: 7805 $
**********************************************/

define('THEME_HAS_PROGRESS_GRAPHICS'1);

// HTML template for template sys_menu spacer
$template_sys_menu_spacer '<img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />';

/******************************************************************************
** Section <<<$template_sub_menu>>> - START
******************************************************************************/
// 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 '<img src="themes/water_drop/images/orange_carret.gif" width="8" height="8" border="0" alt="" />';

  
// HTML template for template sys_menu buttons

  
$template_sys_menu_button = <<<EOT
  <!-- BEGIN {BLOCK_ID} -->
        <a href="{HREF_TGT}" title="{HREF_TITLE}" {HREF_ATTRIBUTES}>{HREF_LNK}</a> {SPACER}
  <!-- END {BLOCK_ID} -->
EOT;

  
// HTML template for template sys_menu buttons

    // {HREF_LNK}{HREF_TITLE}{HREF_TGT}{BLOCK_ID}{SPACER}{HREF_ATTRIBUTES}
    
addbutton($sys_menu_buttons,'{HOME_LNK}','{HOME_TITLE}','{HOME_TGT}','home',$template_sys_menu_spacer);
    
addbutton($sys_menu_buttons,'{CONTACT_LNK}','{CONTACT_TITLE}','{CONTACT_TGT}','contact',$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);
    if (
array_key_exists('allowed_albums'$USER_DATA) && is_array($USER_DATA['allowed_albums']) && count($USER_DATA['allowed_albums'])) {
      
addbutton($sys_menu_buttons,'{UPL_APP_LNK}','{UPL_APP_TITLE}','{UPL_APP_TGT}','upload_approval',$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,'{SIDEBAR_LNK}','{SIDEBAR_TITLE}','{SIDEBAR_TGT}','sidebar',$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,'{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.



  
$sys_menu_buttons CPGPluginAPI::filter('sys_menu',$sys_menu_buttons);
  
$params = array('{BUTTONS}' => assemble_template_buttons($template_sys_menu_button,$sys_menu_buttons));
  
$template_sys_menu template_eval($template_sys_menu,$params);
}
/******************************************************************************
** Section <<<$template_sub_menu>>> - END
******************************************************************************/

?>


Αndré

Quote from: _Dana_ on November 26, 2010, 10:34:09 AM
I get is an error: "Fatal error: Call to undefined function addbutton() in D:\Inetpub\LocalUser\ftp_pilefood\www\galleri\themes\pilefood2010\theme.php on line 47"
Just add missing functions to your theme.php file:
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib='')
{
    $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib);
}

_Dana_

Quote from: Αndré on November 26, 2010, 10:47:22 AM
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib='')
{
    $menu[]=array($href_lnk,$href_title,$href_tgt,$block_id,$spacer,$href_attrib);
}


I added that but that just gave me a new error: "Fatal error: Call to undefined function assemble_template_buttons() in D:\Inetpub\LocalUser\ftp_pilefood\www\galleri\themes\pilefood2010\theme.php on line 68"

Which looks like it is pointing to

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

Αndré

Just copy missing functions from themes/sample/theme.php to the theme.php file of your theme.

Walkinman

Hey Andre

I am having exactly this same problem. I copied the function from sample/theme.php .. and now I get this error:

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


I can't find that anywhere in the sample/theme.php .. what next?

Thank you.

Cheers

Carl

Αndré

You removed the required login button from the template. Just put it back to its place.

Walkinman

Hey Andre

Thank you.

I don't recall removing anything like that from the template. I don't even see that anywhere in a clean version of the template.

Anyway, I redid the edit this morning, and now it works. I'm not sure why or what is different, but the error message is gone now.

Thank you.

Cheers

Carl

solipsism

I looked really hard to find this answer, and I don't think it was actually completed nicely. To save someone else the trouble I just spent 4 hours on. I am going to recap the exact procedure I got to add a new extra button to the nave of water drop based theme (which has an almost blank theme.php file)


1. replace the theme.php file in water drop's existing theme thusly:

goto the "Sample" theme in the coppermine/theme directory:


copy everything (about the first 180 lines)down to and including this:

/******************************************************************************
** Section <<<THEME_HAS_NO_SYS_MENU_BUTTONS>>> - END
******************************************************************************/


Open up the theme.php file in the "water drop theme"  and paste that whole copy right over top of everything in the theme that is there already.

So now the theme.php file has something to work with.

--------------------------------------------------------------------
2. To put an extra button on the nav (other than the one from config...so say your 2nd, third, fourth...buttons) you clone ONE line. replace the token kinda things with english and the url, and you are done thusly:


The line you are looking for is:
+++++++++++



addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$t

emplate_sys_menu_spacer);
   
+++++++++++++++++++++++++

this seems to be the code that makes the "my gallery" button on the nav (any of these lines will work there are 4 or 5 similar ones except for the labels)

so clone that line getting this:
+++++++++++++++++++++++++++++++++
addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$t

emplate_sys_menu_spacer);
addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$t

emplate_sys_menu_spacer);
++++++++++++++++++++++++++++++++++


then in the second one replace {MY_GAL_LNK} {MY_GAL_TITLE} {MY_GAL_TGT} my-gallery
with actual english and the url (keeping the single quotes).So i wanted a link to google, so i ended up with:




------------------------------------------------------------------
addbutton($sys_menu_buttons,'{MY_GAL_LNK}','{MY_GAL_TITLE}','{MY_GAL_TGT}','my_gallery',$t
emplate_sys_menu_spacer);

addbutton($sys_menu_buttons,'googlelink','go to google','http://www.google.com','google',$template_sys_menu_spacer);
------------------------------------------------------------------------

those two lines make changes to the nav to add a new link that shows up as "googlelink" in this case.

eg:    Home* my gallery * googlelink * contact * etc


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

You don't have to change any other code. If you want more buttons, just clone that line
again  and fill in the text for the link and the url, you can put them in whatever order you want to move them around..


It seems to work, so i hope that helps. I realize this is an older thread, but I really couldnt find the actual answer so there it is.






Dankriss


Yep I just spent 4hrs trying to find out how to do this....thank you so much for simplifing for us :D just added a line to the inc. file and yep it worked!  now to play around a bit!

Once again thanks!

Kriss :)
Good with HTML and CSS but no good with script... so please bear with me.. :)