Forum Subject: Multiple Galleries Problem

Posted on: 02/18/04 02:53pm
By: laughable

I have a site that supports two seperate photographers. We are running two embedded installations of Gallery.....

And would like to use the Random Gallery block and they standard Gallery Block on the main page for both Gallery installations.

This doesn't work with the current incarnation of these blocks, because the both call /path/to/gallery/init.php

And then gallery is confused about its context. That is both the RandomBlock & the Gallery Block have to point to the same gallery basedir for the php to work its magic.

Multiple incarnations of either of those blocks also must point to the same basedir.

IANAC (I am not a coder), I don't even play one on tv. Could someone please assist....

Multiple Galleries Problem

Posted on: 02/18/04 03:35pm
By: Turias

If you have two separate gallery installs, I see no problem with installing the blocks you want two different times, pointing one install to the first gallery instance and the second install to the second gallery instance. Thus, one block calls /path/to/first/gallery/init.php and the other calls /path/to/second/gallery/init.php.

Just make sure that you name everything uniquely. For example, you will need two separate cache files for the random-photo block.

Multiple Galleries Problem

Posted on: 02/18/04 04:12pm
By: laughable

I believe I have "been there.. done that" because of course that was my first guess as to how to skin the beast. Seperate out everything right down to the function naming in lib-custom....
But I get no joy.....

Multiple Galleries Problem

Posted on: 02/18/04 04:26pm
By: Turias

Well, what went wrong? Any error messages? Are you sure you didn't forget to rename something?

Multiple Galleries Problem

Posted on: 02/18/04 05:21pm
By: asmaloney

Yeah, the problem is in the inclusion of two init.php files, as they try to declare the same functions twice:

PHP Fatal error: Cannot redeclare editfield() (previously declared in /.../gallery2/util.php:33) in /.../gallery/util.php on line 33

I don't really know how to work around this, but let me think about it some more. I wish PHP had namespaces...

[Just had flashbacks to COBOL's COPY...REPLACING statements <shudder>.]

Multiple Galleries Problem

Posted on: 02/18/04 06:04pm
By: Turias

What if you remove:

require($GALLERY_BASEDIR . "util.php");

from the second instance of Gallery? (Make sure that is the one that is loaded second.)

Multiple Galleries Problem

Posted on: 02/18/04 06:10pm
By: asmaloney

[QUOTE BY= Turias] What if you remove:

require($GALLERY_BASEDIR . "util.php");

from the second instance of Gallery? (Make sure that is the one that is loaded second.)[/QUOTE]

No, there are too many functions and classes which are included twice for this work.

Multiple Galleries Problem

Posted on: 02/18/04 06:12pm
By: laughable

Thanks guys! I am glad to hear you're on the case.

Multiple Galleries Problem

Posted on: 02/18/04 09:50pm
By: laughable

New problem... for mr. maloney.
I can run Random block in an anonymous context (not logged in) for both gallery installs. (ON seperate pages As you correctly duplicated my

PHP Fatal error: Cannot redeclare editfield() (previously declared in /.../gallery2/util.php:33) in /.../gallery/util.php on line 33


And I can run your GalleryBlock in Admin mode or logged in, but _NOT_ in an anonymous context.

I get

Fatal error: Call to a member function on a non-object in /var/www/rklphoto/classes/User.php on line 136

1.) on multiple browsers/machines
2.) having removed all my duplication hacks (fresh from the tar)
3.) reinstalled thegallery integration package fresh from the tar)

Again things look fine whil I am logged in but as soon as I log out.. *Smack* I get an error.

Any thoughts?

Multiple Galleries Problem

Posted on: 02/19/04 12:53pm
By: asmaloney


As far as I can tell, using more than one gallery installation with the Gallery Block is not going to be possible with PHP 4. The problem is we cannot include the required files from multiple galleries because they define the same functions. As far as I can tell there's no way to limit the scope of the funcions in the included files to allow for this.

Now, PHP 5 might have namespaces which could potentially be used to solve this [how many conditionals can I possibly use?], but I think that's a long way off.

Does anyone with more knowledge of PHP have any suggestions?

[w.r.t. the 'new problem', I can't reproduce it and am waiting for more info from 'laughable'. If anyone else has similar problems, please contact me.]

Multiple Galleries Problem

Posted on: 02/20/04 01:11pm
By: asmaloney

[QUOTE BY= asmaloney]
[w.r.t. the 'new problem', I can't reproduce it and am waiting for more info from 'laughable'. If anyone else has similar problems, please contact me.][/QUOTE]
The 'new problem' has been solved. It was caused by newlines in some of the album titles. I have fixed this and a couple of other things and put v1.0.1 on my website [IMoL[*1] ].

Multiple Galleries Problem

Posted on: 02/20/04 09:38pm
By: Anonymous (laughable)

I just wanted to publically thank Andy. He made an excellent plugin and was incredibly helpful resolving this issue.



Somebody should buy him a beer.

--laughable

Geeklog - Forum Subject: Multiple Galleries Problem
https://www.geeklog.net/forum/viewtopic.php/30781

[*1] http://imol.gotdns.com