Mambo 4.5.1 + Gallery 1.5 CVS + random block

jefman

Joined: 2004-05-07
Posts: 6
Posted: Wed, 2005-01-26 13:22

I have installed mambo 4.5.1a and gallery 1.5 cvs on a pc with Wamp5 1.4.3 server (apache + php + mysql packages).

in mambo component I have set path to gallery as "c:\wwwroot\gallery\". I have Published the random_block on my right and I can see an image but when I click the image I get the large one but on the right side I get:

Fatal error: Cannot redeclare getrequestvar() (previously declared in c:\wwwroot\gallery\util.php:29) in c:\wwwroot\gallery\util.php on line 46

and if I go to the top level also get this:

Warning: Invalid argument supplied for foreach() in c:\wwwroot\gallery\util.php on line 3591

My Mambo/gallery URL: http://machome.mine.nu/mambo/index.php?option=com_gallery

Any ideas on this problem ?

/Jefman

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Wed, 2005-01-26 16:36

The random block is being incorrectly included.

You either need to make sure that the random block is not loaded when viewing Gallery pages, or correct the include according to the instructions located in the sticky post at the top of the Random Block forum.

 
jefman

Joined: 2004-05-07
Posts: 6
Posted: Wed, 2005-01-26 23:17

I reinstalled the component from the contrib folder and downloaded the mod_block_random.zip from http://www.gallery-addons.com/content/view/30/68/.

I get a random block in mambo but as soon as i klick the image I get

Fatal error: Cannot redeclare getrequestvar() (previously declared in c:\wwwroot\gallery\util.php:29) in c:\wwwroot\gallery\util.php on line 46

I have no idea on what I do wrong, I have done just as it say....

I use gallery 1.5-cvs-b327.

/Jefman

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Thu, 2005-01-27 17:35

Every mod_block_gallery.zip, that I have found, is including the block-random.php in a incorrect way.

Here is the code:

<?php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_EMBEDDED_INSIDE_TYPE;
global $GALLERY_MODULENAME;
global $include;
global $option;

$option = "com_gallery";          // Tells Gallery that we're inside Mambo
$include = "block-random.php";    // ... and that we want block-random.php.
//define ('GALLERY_URL',"/path/to/your/gallerybasedir");
	
$database->setQuery('SELECT `value` FROM #__gallery WHERE `field` = \'path\'');
define ('GALLERY_URL',$database->loadResult() );


$GALLERY_MODULENAME = $option;
$GALLERY_EMBEDDED_INSIDE = 'mambo';
$GALLERY_EMBEDDED_INSIDE_TYPE = 'mambo';

include(GALLERY_URL . "/$include");

?>

In my copy I have rebuilded the hole component for mambo so it's a option in the admin backend to specify the gallery URL also. Not just the server path. That way, the module above is including block-random.php with the URL instead. (I have rebuilded the code above, yes...)

Maybe the author of this module should change this so not everyone is complaining about problems here? :wink:

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Thu, 2005-01-27 17:41

Blinkiz, that code is completely incorrect.

$database->setQuery('SELECT `value` FROM #__gallery WHERE `field` = \'path\'');
define ('GALLERY_URL',$database->loadResult() ); 

This loads a physical path (/home/you/gallery). If you read the Random Block documentation, it is *required* that you load it via HTTP, or you will see the errors that are currently being reported. (Duplicate declarations)

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Thu, 2005-01-27 18:08

Yeah, I know.

I have added a column in the database, "pathurl" that will store the absolute URL. And then coded the line you prompted with \'pathurl\' instead of \'path\'

Maybe I should publish my version of the component/module? ;)

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Thu, 2005-01-27 18:25

I can get the serverpath to gallery, then I should be able to retrive the absolute path from the config.php, right?

Maybe someone could help me with that line?
The serverpath is located here:

$database->setQuery('SELECT `value` FROM #__gallery WHERE `field` = \'path\'');
define ('GALLERY_URL',$database->loadResult() );

Then if someone just can help me retrive the absolute URL path from "$GALLERY_URL."/config.php" everything will be solved :D

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Thu, 2005-01-27 19:17
define ('GALLERY_URL_PATH',$mosConfig_live_site.'/index.php?option=com_gallery&include=block-random.php');
include(GALLERY_URL_PATH);

I get the error

Parse error: parse error, unexpected T_STRING in http://www.mydomain.com/%7Egetweb/main/index.php?option=com_gallery&include=block-random.php on line 1

Why? ;)
If I type the above absolute URL path in my browser, a random picture is coming up. So the path is correct.

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Thu, 2005-01-27 19:25

Well, you actually want to be including

"/modules/gallery/block-random.php" (or appropriate path), not the mambo index.

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Thu, 2005-01-27 21:40

jehupp.... :-?

Can I do this then?

<?php

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_EMBEDDED_INSIDE_TYPE;
global $GALLERY_MODULENAME;
global $include;
global $option;

$option = "com_gallery";          // Tells Gallery that we're inside Mambo
$include = "block-random.php";    // ... and that we want block-random.php.
//define ('GALLERY_URL',"/path/to/your/gallerybasedir");

$database->setQuery('SELECT `value` FROM #__gallery WHERE `field` = \'path\'');
define ('GALLERY_URL',$database->loadResult() );

$GALLERY_MODULENAME = $option;
$GALLERY_EMBEDDED_INSIDE = 'mambo';
$GALLERY_EMBEDDED_INSIDE_TYPE = 'mambo';

include(GALLERY_URL . "/config.php");
include($gallery->app->photoAlbumURL. "/$include");
?>

It works, but I don't know if it's a secure and effective way.

 
kai_tom

Joined: 2004-04-08
Posts: 347
Posted: Fri, 2005-01-28 07:33

Hi,

with this code I can show the random module together with Gallery, but when I click on the random image Gallery jumps out of Mambo and open standalone.

Gallery 1.5-cvs-b330
Mambo 4.5.1

Kai

 
Blinkiz
Blinkiz's picture

Joined: 2002-11-14
Posts: 36
Posted: Fri, 2005-01-28 20:47

You can probably include config.php higher up in the script and get it to work.

Anyway, am giving up. Random picture from gallery dosn't work for me. If it's not this problem, is "no photo choosen" problem because my gallery is for registreted only.

See ya when G2 is launched!

 
muskiediver
muskiediver's picture

Joined: 2003-08-07
Posts: 43
Posted: Sun, 2005-07-10 14:54

I tried this code:

<?php

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_EMBEDDED_INSIDE_TYPE;
global $GALLERY_MODULENAME;
global $include;
global $option;

$option = "com_gallery"; // Tells Gallery that we're inside Mambo
$include = "block-random.php"; // ... and that we want block-random.php.
//define ('GALLERY_URL',"/path/to/your/gallerybasedir");

$database->setQuery('SELECT `value` FROM #__gallery WHERE `field` = \'path\'');
define ('GALLERY_URL',$database->loadResult() );

$GALLERY_MODULENAME = $option;
$GALLERY_EMBEDDED_INSIDE = 'mambo';
$GALLERY_EMBEDDED_INSIDE_TYPE = 'mambo';

include(GALLERY_URL . "/config.php");
include($gallery->app->photoAlbumURL. "/$include");
?>

And as someone mentioned earlier in this thread,when you click on the random image it jumps out of mambo to the gallery stand alone. Did anyone resolve this problem?

 
muskiediver
muskiediver's picture

Joined: 2003-08-07
Posts: 43
Posted: Sun, 2005-07-10 14:58

I tried moving Blinkiz suggestion; "You can probably include config.php higher up in the script and get it to work" but that did not work. I have contact the author and sent him this thread and hope he can help us.

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Sun, 2005-07-10 22:06

muskiediver, I say this so often on so many threads...

You can't successfully load the random block directly by file. You must include it via http.

Navigate to a Gallery URL, then replace the active filename with block-random.php. (I don't have Mambo installed right now, or I'd give a more accurate example.)

Something similar to:
include('http://yoursite/mambo/index.php?option=com_gallery&include=block-random.php');