random block outside gallery dir

peterh

Joined: 2003-07-01
Posts: 34
Posted: Sat, 2003-10-18 22:52

is there a way to get random-block.php to work outside of the gallery directory? i tried defining the location of the init.php file manually but it still gives errors!

any help appreciated.

 
nsabine

Joined: 2003-11-21
Posts: 3
Posted: Fri, 2003-11-21 20:16

I had this same problem. I don't know if this is the right solution, but it's how I got it to work:

1. Leave random-block.php in your gallery directory.

2. add this code to the top of the .php file you want to display the random photo in:

<?php
global $GALLERY_EMBEDDED_INSIDE;
global $GALLERY_BASEDIR;
global $GALLERY_NO_SESSIONS;
$GALLERY_EMBEDDED_INSIDE = "mt";
$GALLERY_BASEDIR = "/path/to/gallery/";
$GALLERY_NO_SESSIONS = true;
?>

3. add the php code to import the random-block.php file:

<?php include ("/path/to/gallery/block-random.php"); ?>

-- note: I am running Movable Type, and did not want gallery to attempt to set the content type, therefore set $GALLERY_EMBEDDED_INSIDE = "mt" above. If you have gallery embedded in nuke or otherwise, you may want to skip this step. This is just a hack to get it working on my website.

Hope it helps

-Nick
http://www.esabine.net

 
sethp

Joined: 2002-11-05
Posts: 16
Posted: Sun, 2003-12-28 18:53

This solution fixed this problem for me too, running Gallery 1.3.3 standalone.

I also had to fix another problem described here related to the bit of rand() code that caused a parameter warning:

http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=9180

My random block is showing up nicely on my home page index.php while gallery is running in a subdir! http://packhams.com