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!
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.
Posts: 3
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:
3. add the php code to import the random-block.php file:
-- 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
Posts: 16
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