Advanced search  

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]

Pages: [1]   Go Down

Author Topic: water drop theme - sys_menu / sub_menu  (Read 11229 times)

0 Members and 1 Guest are viewing this topic.

_Dana_

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 12
  • Nothing in the world is the way it ought to be.
    • Dana.TheDudes.Nu
water drop theme - sys_menu / sub_menu
« on: November 26, 2010, 09:03:51 am »

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.

Code: [Select]
<?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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: water drop theme - sys_menu / sub_menu
« Reply #1 on: November 26, 2010, 09:23:00 am »

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.
Logged

_Dana_

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 12
  • Nothing in the world is the way it ought to be.
    • Dana.TheDudes.Nu
Re: water drop theme - sys_menu / sub_menu
« Reply #2 on: November 26, 2010, 10:34:09 am »

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
Code: [Select]
/******************************************************************************
** 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
Code: [Select]
<?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
******************************************************************************/

?>

Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: water drop theme - sys_menu / sub_menu
« Reply #3 on: November 26, 2010, 10:47:22 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:
Code: [Select]
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);
}
Logged

_Dana_

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 12
  • Nothing in the world is the way it ought to be.
    • Dana.TheDudes.Nu
Re: water drop theme - sys_menu / sub_menu
« Reply #4 on: November 26, 2010, 10:56:46 am »

Code: [Select]
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
Code: [Select]
$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);
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: water drop theme - sys_menu / sub_menu
« Reply #5 on: November 26, 2010, 11:00:55 am »

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

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: water drop theme - sys_menu / sub_menu
« Reply #6 on: March 19, 2011, 10:24:54 am »

Hey Andre

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

Code: [Select]
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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15765
Re: water drop theme - sys_menu / sub_menu
« Reply #7 on: March 19, 2011, 12:34:20 pm »

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

Walkinman

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 380
    • Skolai Images - Nature, Travel and Adventure stock photos
Re: water drop theme - sys_menu / sub_menu
« Reply #8 on: March 19, 2011, 07:17:27 pm »

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
Logged

solipsism

  • Coppermine newbie
  • Offline Offline
  • Posts: 13
Re: water drop theme - sys_menu / sub_menu
« Reply #9 on: April 23, 2012, 10:17:25 am »

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.





Logged

Dankriss

  • Coppermine regular visitor
  • **
  • Country: gb
  • Offline Offline
  • Gender: Female
  • Posts: 97
    • Nikmania
Re: water drop theme - sys_menu / sub_menu
« Reply #10 on: June 17, 2012, 01:08:21 pm »


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 :)
Logged
Good with HTML and CSS but no good with script... so please bear with me.. :)
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 21 queries.