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] 2   Go Down

Author Topic: Adding a menu on the left hand side  (Read 12926 times)

0 Members and 1 Guest are viewing this topic.

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« on: March 17, 2004, 12:35:41 am »

Hi,

We want to add a menu on the left hand side of the gallery which is a link to a PHP page.

In our theme's template.html file, we have a table with 2 columns. The right column contains the usual Coppermine stuff, and we want the left to contain another HTML page (actually a PHP page).

What we would like to do is use something like a PHP-include.

We have read the FAQ and know how to use the pageheader and pagefooter functions to emulate PHP-includes, but since this stacks things vertically, it doesn't work for us.

Please look at http://jcr.chu.cam.ac.uk/forum/phpBB2/index.php to get an idea of the kind of menu we want.

Any help is appreciated!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #1 on: March 17, 2004, 09:15:33 am »

This requires several steps, like this:
  • as you can't add php to template.html, you'll have to add a placeholder only, like {MY_CUSTOM_CONTENT} in template.html.
  • Then modify theme.php as well and search for
    Code: [Select]
           '{ADMIN_MENU}' => theme_admin_mode_menu(),and add in a new line after it
    Code: [Select]
           '{MY_CUSTOM_CONTENT}' => theme_my_custom_content(),
  • find
    Code: [Select]
    function theme_html_picinfo(&$info)and add before
    Code: [Select]
    function theme_my_custom_content()
    {
    include_once('my_html_page.htm');
    }

  • save, upload and test...[/list:u]I'm not sure if I haven't forgotten a step (haven't tried in detail). Please report...

    GauGau
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #2 on: March 21, 2004, 08:39:45 pm »

Hey,

I did what you said, and the php page I link to is included. The only problem is that it is all drawn at the top of the page, and the Coppermine stuff is below it.

The page structure is a table with 1 row and 2 columns. The tag {CHU_LEFT_MENU} is in the first column (which has a fixed width) and the Coppermine stuff is on the right one.

I then included the changes that you mentioned:

Code: [Select]

'{ADMIN_MENU}' => theme_admin_mode_menu(),
'{CHU_MENU_LEFT}' => theme_chu_menu_left()
);


and

Code: [Select]

// Adds the left menu
function theme_chu_menu_left()
{
        include_once('http://jcr.chu.cam.ac.uk/menu.php');
}

function theme_html_picinfo(&$info)
{
    global $lang_picinfo; ...


I have left the site in its current (broken) state (it isn't linked yet) so that you can get an idea of what I mean: http://jcr.chu.cam.ac.uk/photoalbum/

Do you have any suggestions?

Thanks
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #3 on: March 21, 2004, 11:25:38 pm »

actually {CHU_LEFT_MENU} is still visible in the source code of your page, so I guess you just replaced {CHU_HEADER} in theme.php. You'll have to modify theme.php as well to replace your custom navigation {CHU_LEFT_MENU}. If I were you, I'd include the site logo statically (with plain html) and only incude the menu dynamically.

GauGau
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #4 on: March 22, 2004, 02:30:49 pm »

The reason that the {CHU_LEFT_MENU} was still visible in the source code was that I had used a different tag name ({CHU_MENU_LEFT}) in the theme.php file.

On changing it, the tag no longer appeared on the HTML page, but the problem still remains.

It seems to me that Coppermine stacks everything vertically and has trouble having something to the left or right of the main section. I have tred having the site logo static and link dynamically only to the menu, but the same problem arose.

The broken site is still up at http://jcr.chu.cam.ac.uk/photoalbum/

Any suggestions?

Thanks :)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #5 on: March 22, 2004, 05:24:49 pm »

difficult to say without being able to look into your files. I have it running on my personal page (plus some other modifications), so I can assure you it works the way described. Try double-checking what you did. Coppermine does not stack things horizontally - maybe you have some imporper nesting of table tags somewhere (one </tr> to much and you'll experience the troubles you currently go through).

GauGau
Logged

shoobeedoodoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Adding a menu on the left hand side
« Reply #6 on: March 24, 2004, 04:39:16 am »

Hi,
I'm trying to do the same thing, with the menu on the left hand side, and I'm also getting it where my menu appears above the photo gallery, instead of to the left.  I followed your directions, but I just can't figure out what's wrong.  Does anyone have any suggestions?

Thanks!

-Stephen
Logged

shoobeedoodoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Adding a menu on the left hand side
« Reply #7 on: March 24, 2004, 05:08:20 am »

By the way, I'm trying to edit the theme "project_vii" to have the left hand menu, if that helps.

Thanks!

-Stephen
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #8 on: March 24, 2004, 07:26:09 am »

@shoobeedoodoo: link?

GauGau
Logged

shoobeedoodoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Adding a menu on the left hand side
« Reply #9 on: March 24, 2004, 08:48:35 am »

I've been playing around with it and trying various things out, but it still doesn't work, please check

http://www.shoobeedoodoo.com/coppermine/

Thansk!

-Stephen
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #10 on: March 24, 2004, 08:55:38 am »

looking at the source code of your page I see
Code: [Select]
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Links</title>
<base target="main">
</head>

<body topmargin="0" leftmargin="0">

<p><map name="FPMap0">
<area target="_top" coords="0, 153, 86, 178" shape="rect" href="http://www.shoobeedoodoo.com/gallery/">
<area target="_top" href="http://www.shoobeedoodoo.com/pages/topten.htm" shape="rect" coords="0, 214, 96, 247">
<area target="_top" href="http://www.shoobeedoodoo.com/" shape="rect" coords="1, 17, 91, 51">
</map>
<img border="0" src="links6.jpg" usemap="#FPMap0" width="116" height="463"></p>

</body>

</html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
[...]
I guess you'll have to grab some html basics first. Edit http://www.shoobeedoodoo.com/coppermine/themes/project_vii/template.html first to create some decent html - don't use any wysiwyg editor, but a text editor (notepad is fine).
I also suggest you start off with a theme that is easier to modify for newbies - take a look at the default theme - as it doesn't complicate things with layer techniques, or look at fruity, as it already has got a left-hand menu.

GauGau
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #11 on: March 24, 2004, 09:03:32 pm »

Hey,

Still no luck :( I went through my code and made sure that the tables etc were properly nested and they were. I also checked whether I followed your instructions properly, and I had.

I am not sure how to proceed from here.

A few more things:
 - To come up with my theme, I edited water_drop
 - If I manually insert HTML code in the template.html file, everything is fine. It's just when I want to use PHP in theme.php to insert it that it goes all wrong. I have tried including a non-PHP page too (the file I link to is a PHP page) and the same thing happened.

My theme.php file is accessible here (renamed to a txt file) http://jcr.chu.cam.ac.uk/admin/theme.txt. My template.html file is accessible on http://jcr.chu.cam.ac.uk/photoalbum/themes/chujcr/template.html.

Hope this helps...

Thanks
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #12 on: March 24, 2004, 09:52:09 pm »

test for basic functionality by replacing
Code: [Select]
// Adds the left menu
function theme_chu_menu_left()
{
        include_once('http://jcr.chu.cam.ac.uk/menu.php');
}
by
Code: [Select]
// Adds the left menu
function theme_chu_menu_left()
{
        print 'Hello world';
}
Does this work as expected?

GauGau
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #13 on: March 24, 2004, 10:26:51 pm »

When I replace it with the print statement, the text is printed fine, but all the Coppermine stuff is pushed down (as before).

To verify this, I added the following code:

Code: [Select]

// Adds the left menu
function theme_chu_menu_left()
{
        //include_once('http://jcr.chu.cam.ac.uk/menu.php');
        print 'Hello world <br>';
        print 'Hello world <br>';
        print 'Hello world <br>';
        print 'Hello world <br>';
        print 'Hello world <br>';
}


Any suggestions?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Adding a menu on the left hand side
« Reply #14 on: March 25, 2004, 08:36:17 am »

my suggestion was to remove the include temporarily to check if the print statement alone does what it's supposed to do. Did you try that as well?

GauGau
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #15 on: March 25, 2004, 11:08:28 am »

Yes. I first had just one print statement, which worked fine. It looked as if the Coppermine stuff was pushed down, though so I had several print lines with <br> tags to make the effect more obvious.

In all these tests, the include was commented out.
Logged

shoobeedoodoo

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Adding a menu on the left hand side
« Reply #16 on: March 25, 2004, 07:25:28 pm »

Thanks for the tips GauGau, I played around with the tables and kind of got what I wanted.  I was just wondering how to move the login link so it alligns with the gallery?  If you check http://www.shoobeedoodoo.com/coppermine you'll see what I mean.  Also, how do I make it so the gallery is flush with the menu, as there's some space in between right now.

Thanks for all the help!

-Stephen
Logged

Haelios

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Adding a menu on the left hand side
« Reply #17 on: March 25, 2004, 07:28:15 pm »

@shoobeedoodoo:

Is that menu on the left hand side dynamically linked? Or a static set of images?

Thanks
Logged

alexisb

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Got same problem here
« Reply #18 on: March 25, 2004, 09:01:15 pm »

Hello, I got the same problem here.

Anything that is output using this method is shown at the top of the page.

I am just trying with a simple:

echo "test";

It doesn't matter where i put the placeholder on template.html, if something is printed using this method is put on top.

Any other ideas?

Regards!
Logged

alexisb

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
I got it!
« Reply #19 on: March 25, 2004, 09:06:51 pm »

Wow, that was fast! :)

Analyzing Coppermine functions I saw that they don't "echo" the output, but they "return" it from the function.

So, in your function instead of using something like:

echo "This is my output";

Use this:

return "This is my output";

Let me know if you get it working

Regards!
Logged
Pages: [1] 2   Go Up
 

Page created in 0.028 seconds with 18 queries.