coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: Haelios on March 17, 2004, 12:35:41 AM

Title: Adding a menu on the left hand side
Post by: Haelios 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!
Title: Adding a menu on the left hand side
Post by: Joachim Müller on March 17, 2004, 09:15:33 AM
This requires several steps, like this:
Title: Adding a menu on the left hand side
Post by: Haelios 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:


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


and


// 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
Title: Adding a menu on the left hand side
Post by: Joachim Müller 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
Title: Adding a menu on the left hand side
Post by: Haelios 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 :)
Title: Adding a menu on the left hand side
Post by: Joachim Müller 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
Title: Adding a menu on the left hand side
Post by: shoobeedoodoo 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
Title: Adding a menu on the left hand side
Post by: shoobeedoodoo 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
Title: Adding a menu on the left hand side
Post by: Joachim Müller on March 24, 2004, 07:26:09 AM
@shoobeedoodoo: link?

GauGau
Title: Adding a menu on the left hand side
Post by: shoobeedoodoo 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
Title: Adding a menu on the left hand side
Post by: Joachim Müller on March 24, 2004, 08:55:38 AM
looking at the source code of your page I see<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
Title: Adding a menu on the left hand side
Post by: Haelios 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
Title: Adding a menu on the left hand side
Post by: Joachim Müller on March 24, 2004, 09:52:09 PM
test for basic functionality by replacing// Adds the left menu
function theme_chu_menu_left()
{
        include_once('http://jcr.chu.cam.ac.uk/menu.php');
}
by// Adds the left menu
function theme_chu_menu_left()
{
        print 'Hello world';
}
Does this work as expected?

GauGau
Title: Adding a menu on the left hand side
Post by: Haelios 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:


// 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?
Title: Adding a menu on the left hand side
Post by: Joachim Müller 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
Title: Adding a menu on the left hand side
Post by: Haelios 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.
Title: Adding a menu on the left hand side
Post by: shoobeedoodoo 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
Title: Adding a menu on the left hand side
Post by: Haelios 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
Title: Got same problem here
Post by: alexisb 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!
Title: I got it!
Post by: alexisb 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!
Title: Adding a menu on the left hand side
Post by: shoobeedoodoo on March 25, 2004, 09:36:52 PM
@Haelios, the menu on the left hand side is static html, I couldn't get the dynamic to work, as coppermine would stack everything below it, but now I'm interested in trying to use the return function instead of the include function, as alexisb had suggested.
Title: Confirmed
Post by: alexisb on March 26, 2004, 05:32:18 AM
Now it's working for me, as I put in my last post: You have to return a value (in most cases is a string) from your function.

Regards!.
Title: Adding a menu on the left hand side
Post by: Haelios on March 26, 2004, 11:41:09 AM
Well done alexisb, you just solved my problem  :wink:

Just for the record, this was the code that I ended up using. I think it's pretty safe (just in case my dynamic page gets a bit big) but I'm sure that there is a better way to do it, so please let me know if you have a more cunning way.


// Adds the left menu
function theme_chu_menu_left()
{
        //include_once('http://jcr.chu.cam.ac.uk/menu.php');
        $handle = fopen("http://jcr.chu.cam.ac.uk/menu.php", "r");
        $leftmenu = "";
       
        do {
           $lmdata = fread($handle, 8192);
           if (strlen($lmdata) == 0) {
                   break;
           }
           $leftmenu .= $lmdata;
        } while (true);
        fclose($handle);
       
        return $leftmenu;
}


Thanks again gaugau for the help :)

Sid
Title: Adding a menu on the left hand side
Post by: Joachim Müller on March 26, 2004, 03:01:07 PM
haven't tested, but you could try this:
// Adds the left menu
function theme_chu_menu_left()
{
   $leftmenu = "";
   ob_start();
   include_once('http://jcr.chu.cam.ac.uk/menu.php');
   $leftmenu = ob_get_contents();
   ob_end_clean();    
   return $leftmenu;
}
GauGau