Random Module for Mambo 4.5?

SonicStang

Joined: 2004-01-18
Posts: 3
Posted: Sun, 2004-01-18 22:25

I am searching for the above mentioned.
It can also be a hack for plain html-sites. It's easy to integrate html into a Mambo Module.
I already tried to integrate "<? php include("http://www.mywebsite.com/gallery/block-random.php"); ?> but this didn't suffice.

 
jclowers
jclowers's picture

Joined: 2003-12-02
Posts: 3
Posted: Mon, 2004-07-19 21:58

Any thoughts on this... I could use the same thing...

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Mon, 2004-07-19 22:07

What about including block-random.php directly didn't work?

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Tue, 2004-07-20 08:10

Here is some code that I got working as a random photo Mambo module, while evaluating Mambo for my family site. This may not be the best way to do it, but I share it here as-is so that perhaps you can use it. However, I can not support this; I have decided not to stick with Mambo.

Assuming you know how to package up a Mambo component (beyond the scope of this discussion, see the Mambo resources), create a file called, for instance, "mod_block_random.php" containing the following 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 $op;
global $mop;
global $include;
global $name;
global $option;

$option = "com_gallery";          // Tells Gallery that we're inside Mambo 
$include = "block-random.php";    // ... and that we want block-random.php.
	
if (isset($option)) {
        $GALLERY_MODULENAME = $option;
        define ('GALLERY_URL',"/path/to/your/gallerycode");
        $GALLERY_EMBEDDED_INSIDE = 'mambo';
        $GALLERY_EMBEDDED_INSIDE_TYPE = 'mambo';
}

include(GALLERY_URL . "/$include");

?>

You will need, obviously, to properly initialize GALLERY_URL with the correct path for you installation.

(Note: I had to hack Gallery's session.php to overcome Warnings about "foreach" and "invalid arguments". Seems as if that may have been a problem local to my configuration, though.)

You can see the result in action on my test site: [url]www.barca-hall.com/index.php[/url].

Good luck!

-Jeff

 
kai_tom

Joined: 2004-04-08
Posts: 347
Posted: Tue, 2004-07-20 13:43

Jeff,
thank you very very much for this code, works fine with my Mambo. :D

Regards
Kai

 
lawrence

Joined: 2002-12-28
Posts: 24
Posted: Thu, 2004-08-05 14:33

Hi I have interest to do this also, but

,"/path/to/your/gallerycode

is just too technical for me.

can someone explain what is the meaning of "gallery code" pls

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Thu, 2004-08-05 20:32
lawrence wrote:
Hi I have interest to do this also, but

,"/path/to/your/gallerycode

is just too technical for me. can someone explain what is the meaning of "gallery code" pls

Good news. You no longer need not to worry about that. After saying I wasn't going to do it, I went ahead and made this into an installable Mambo module (which will read your com_gallery configuration to get that GALLERY_URL value itself).

To use this random block module for Mambo:

1. Download the module package: http://www.barcahall.com/mod_block_random.zip

2. Install it: Mambo Admin, choose Modules > Install/Uninstall.

3. Configure it just as you would other Mambo modules.

4. Limitations:
- I've only tested this with the official block-random.php being distributed with Gallery as of 1.4.4.
- This module can not be displayed when Mambo is displaying your Gallery page(s) themselves.

This should make it more usable.
-Jeff

 
lawrence

Joined: 2002-12-28
Posts: 24
Posted: Fri, 2004-08-06 06:10

Thanks Jeff.

I install the module and got this error message

Quote:
Warning: main(/block-random.php): failed to open stream: No such file or directory in /home/cepa/public_html/mambo/modules/mod_block_random.php on line 57

Warning: main(): Failed opening '/block-random.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cepa/public_html/mambo/modules/mod_block_random.php on line 57

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Fri, 2004-08-06 07:00

Check that your "Path to Gallery" setting is configured properly in com_gallery. Do you have Gallery working embedded in Mambo?

-Jeff

 
lawrence

Joined: 2002-12-28
Posts: 24
Posted: Mon, 2004-08-09 14:54

it's not really embedded.

I used wrapper to wrap the gallery.

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Tue, 2004-08-10 03:54
lawrence wrote:
it's not really embedded.

I used wrapper to wrap the gallery.

Sorry. I have no idea how to make this work, then. This module for random photos takes advantage of the great support, since Gallery 1.4.3, to operate embedded in Mambo. Enabling Gallery to integrate inside Mambo is described, for instance, in: http://forum.mamboserver.com/showthread.php?t=4642

-Jeff

 
jhdesign

Joined: 2004-08-03
Posts: 26
Posted: Sat, 2004-08-14 06:29

I'm using this mod and it only shows the first two albums of 3 or 4 that are there. Any ideas?