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: New System Menu Button - Rainy Day Theme  (Read 6214 times)

0 Members and 1 Guest are viewing this topic.

othersi

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
New System Menu Button - Rainy Day Theme
« on: February 02, 2007, 08:01:15 am »

Hi folks.

I've read through the FAQ about adding links/buttons to the menu... I've tried to decipher the instructions, but I've failed.  It seems to require more understanding of coding than I have... or I'm just not grasping the instructions.

What I'm trying to do is add an extra button on the upper system menu.

I understand the use of the Custom Link option in the config, but that isn't what I need.

I've managed to get the button/link created, but to do so, the only way I could make sense of, was to edit the themes.inc.php file.

I just added a line:

 
Code: [Select]
addbutton($sys_menu_buttons,'Forum','SI Forum','http://www.othersi.com/index.php?action=forum','custom1',$template_sys_menu_spacer);
in the midst of that files "// HTML template for template sys_menu buttons" section.

It is working... but in my search for the method to do this, I've read a lot of advice to NOT edit the themes.inc.php file.

So... wanting to do things the right way, I went back to editing the rainy_day/theme.php file.

But, in this theme, the theme.php file doesn't include the "// HTML template for template sys_menu buttons section" ... well... it does, but it doesn't contain the 'addbutton' code.... just a small block which says:

Code: [Select]
EOT;

// HTML template for template sys_menu buttons
$template_sys_menu_button = <<<EOT
<!-- BEGIN {BLOCK_ID} -->
  <td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
  <td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
  <td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
          <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a>
  </td>
  <td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>
<!-- END {BLOCK_ID} -->
EOT;


I tried copying the sys_menu button "addbutton($sys_menu_buttons....." stuff from the sample theme.php file into the rainy_day theme.php button... but I got parse errors.

I tried opening another themes (hardwired) theme.php file, and saw it was coded in a different way again, with <!-- BEGIN home -->, <!-- END home -->, <!-- BEGIN my_gallery -->, <!-- END my_gallery -->, etc coded.

I copied THAT and pasted it into the rainy_day theme.php file, editing the urls to the proper theme images, and it made didn't give me parse errors, but instead created somewhat broken buttons, and many, many copies of them... there was rows and rows of duplicate buttons.

I read in the FAQ that a plugin would be the best way to go, but then gave an example of coding that alters the admin menu... which isn't what I'm after.

So... I'm stumped.

If someone could show me the proper coding to put into the rainy_day theme.php file, that'd be great.

All I want is the standard buttons in the upper system menu, but with an extra, custom button just to the right of the home button.

You can see the result I'm looking for here:  http://www.othersi.com/gallery/

This was achieved by editing the themes.inc.php file... which, again, I understand is a bad idea... so want to know how to do it "properly"

Thanks in advance. 
« Last Edit: February 17, 2007, 08:18:12 am by GauGau »
Logged

othersi

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: New System Menu Button - Rainy Day Theme
« Reply #1 on: February 15, 2007, 01:15:52 am »

One and only bump. :)
Logged

Nibbler

  • Guest
Re: New System Menu Button - Rainy Day Theme
« Reply #2 on: February 15, 2007, 01:31:38 am »

I'd add it into the sys menu manually, like this:

Code: [Select]
// HTML template for sys_menu
// HTML template for sys_menu
$template_sys_menu = <<<EOT
  <div class="topmenu">
          <table border="0" cellpadding="0" cellspacing="0">
                  <tr>
  {BUTTONS}
<td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
<td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
<td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
<a href="http://www.othersi.com/index.php?action=forum" title="SI Forum">Forum</a>
</td>
<td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>
                  </tr>
          </table>
  </div>
EOT;
Logged

othersi

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: New System Menu Button - Rainy Day Theme
« Reply #3 on: February 16, 2007, 09:14:37 pm »

Thanks.

Not entirely sure if I've understood your instruction... wasn't sure if I should replace some of the existing code with what you gave, or actually just add it.

What I have now is:

Code: [Select]
// HTML template for template sys_menu buttons
$template_sys_menu_button = <<<EOT
<!-- BEGIN {BLOCK_ID} -->
  <td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
  <td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
  <td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
          <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a>
  </td>
  <td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>
<!-- END {BLOCK_ID} -->
EOT;

$template_sys_menu = <<<EOT
  <div class="topmenu">
          <table border="0" cellpadding="0" cellspacing="0">
                  <tr>
                 
                  <td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
<td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
<td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
<a href="http://www.othersi.com/index.php?action=forum" title="SI Forum">Forum</a>
</td>
<td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>

  {BUTTONS}

                  </tr>
          </table>
  </div>
EOT;

And this is working, except for a very minor issue.  The FORUM button appears to the far left, while I'd prefer it in the 2nd position.

Logged

othersi

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: New System Menu Button - Rainy Day Theme
« Reply #4 on: February 16, 2007, 09:19:38 pm »

Oops.... sorry, I spoke too soon.

The above code has caused the FORUM button to appear in both the top menu (with Home, My gallery, etc) and the lower menu (with Album List, Last Uploads, etc).

Can be seen here:  http://www.othersi.com/gallery/index.php
Logged

othersi

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: New System Menu Button - Rainy Day Theme
« Reply #5 on: February 16, 2007, 09:26:18 pm »

Oh man... wish I could edit my posts. lol

I realized I had pasted in your code to the wrong section of my file.

I've "fixed" it... here is my current code for rainy_day/theme.php... the entire file:

Code: [Select]
<?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.10
  $Source$
  $Revision: 3275 $
  $Author: gaugau $
  $Date: 2006-09-03 12:10:47 +0200 (So, 03 Sep 2006) $
**********************************************/

// ------------------------------------------------------------------------- //
// This theme has had all redundant CORE items removed                           //
// ------------------------------------------------------------------------- //

define('THEME_HAS_RATING_GRAPHICS'1);
define('THEME_IS_XHTML10_TRANSITIONAL',1);


// HTML template for sys_menu
// HTML template for sys_menu
$template_sys_menu = <<<EOT
  <div class="topmenu">
          <table border="0" cellpadding="0" cellspacing="0">
                  <tr>
  
<td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
<td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
<td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
<a href="http://www.othersi.com/index.php?action=forum" title="SI Forum">Forum</a>
</td>
<td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>

{BUTTONS}
                  </tr>
          </table>
  </div>
EOT;

// HTML template for template sys_menu buttons
$template_sys_menu_button = <<<EOT
<!-- BEGIN {BLOCK_ID} -->
  <td><img src="images/spacer.gif" width="5" height="25" border="0" alt="" /></td>
  <td><img src="themes/rainy_day/images/button1_r1_c1.gif" width="5" height="25" border="0" alt="" /></td>
  <td style="background-image:url(themes/rainy_day/images/button1_r1_c2.gif)">
          <a href="{HREF_TGT}" title="{HREF_TITLE}">{HREF_LNK}</a>
  </td>
  <td><img src="themes/rainy_day/images/button1_r1_c3.gif" width="5" height="25" border="0" alt="" /></td>
<!-- END {BLOCK_ID} -->
EOT;



?>


The result is still the same, however... the FORUM button is at the far left (would prefer it in position 2... this isn't a big deal though), and there is TWO copies of the FORUM button, in the upper, and lower menu.... I want it just in the top menu.

Logged

Nibbler

  • Guest
Re: New System Menu Button - Rainy Day Theme
« Reply #6 on: February 16, 2007, 09:29:11 pm »

Add some more code :)

Code: [Select]
$template_sub_menu = <<<EOT
  <div class="topmenu">
          <table border="0" cellpadding="0" cellspacing="0">
                  <tr>
  {BUTTONS}
                  </tr>
          </table>
  </div>
EOT;

There might be a better way than this, I'm not an expert on the theme system.
Logged

othersi

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: New System Menu Button - Rainy Day Theme
« Reply #7 on: February 16, 2007, 10:17:24 pm »

Thank you, that removed the button from the sub-menu.  :)
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.