Fatal error with Gallery random block in MOS 4.5.1...
erik1971
Joined: 2004-09-30
Posts: 2 |
Posted: Thu, 2004-09-30 22:08 |
When I try to add a random image block for Gallery 1.4.4-pl2 with Mambo 4.5.1 I get this nasty error in my block when clicking the image or album link (This error also comes when I try to click the embedded gallery link in my mambo main menue): Fatal error: Cannot redeclare editfield() (previously declared in /hsphere/local/home/deepeco/deepeco.net/mambo/gallery/util.php:27) in /hsphere/local/home/deepeco/deepeco.net/mambo/gallery/util.php on line 27 :roll: The module code: <?php global $GALLERY_EMBEDDED_INSIDE; $option = "com_gallery"; // Tells Gallery that we're inside Mambo $database->setQuery('SELECT `value` FROM #__gallery WHERE `field` = \'path\''); $GALLERY_MODULENAME = $option; include(GALLERY_URL . "/$include"); ?> Without the random image block the gallery/mambo relationship works just fine... Any obvious n00b mistake I'm doing or a remedy? (My mambo test site: http://deepeco.net/webdesign) :-? |
|
Posts: 3474
Add this line just above the $GALLERY_MODULENAME = $option line:
$GALLERY_NO_SESSIONS = true;
-Beckett (
)
Posts: 29
I'm getting the same error even after adding the line you mentioned
Posts: 2322
The problem is that Gallery *requires* the random block to be included via HTTP. It can't be included as a direct file.
include("http://your.site/path/to/gallery/block-random.php")
Posts: 3474
ac07080,
Oops I meant to have you add that line to the top of that code, above the block-random.php include. My bad... I didn't read your code closely enough.
signe,
Hm. I had no idea! What requires it to be that way (i.e. not directly includable, but only via HTTP)? (I was previously frustrated with a some of the changes recently in the random block, but perhaps I just didn't understand!). I add the $GALLERY_NO_SESSIONS variable, and everything seems to work...
-Beckett (
)
Posts: 2322
beckett, it's because, while it may not be a problem while viewing other places in the site, Gallery isn't setup to include the same file multiple times.
For instance, if util.php is loaded in the random block, and a user tries to view Gallery on a page where the random block is also present, you'll get errors (like the redefine) because util.php was included twice. The second include will cause the error.
Posts: 3474
Are we still supporting PHP versions pre-require_once()?
Posts: 2322
No
Even before the changes in 1.4.5, we supported 4.0.4pl or higher.
The problem is that I've looked at what would be necessary to achieve an inline-include of the block, and I don't know if it's possible at this time. G1 just doesn't have a robust-enough structure to take that massive a change without a lot of work.
Posts: 2
The Random block will work without changing any of the code, but not on the page together with the Gallery. So if "All" is chosen in the module position managar, the random image block won't work on any page... If the block is set up to show up just on the front page everything is fine...
:wink:
n00b me...
:oops: