Instructions for using the Random Block

signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Sat, 2004-07-24 02:16

Instructions for installing the Random Block into *nuke, and standalone

standalone
Add the following to your PHP-based pages:

Quote:
include('http://your.server/gallery/block-random.php');

postNuke
Create a Core/PHP block with the following

if (pnModAvailable('your-gallery-name'))
        include("http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php");
else
        echo ' ';

Change the URL above to match the information for your server (your.server and your-gallery-name).

phpNuke 7
Create a Core/PHP block with the following
include("http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php");
Change the URL above to match the information for your server (your.server and your-gallery-name).

phpNuke 6
You must modify the themesidebox() function of each theme where you want to use this block. You need to add the following code at the top of the themesidebox() function:

          if (@file_exists($block[content])) {
                  $fp = fopen ($block[content], "r");
                  $block[content] = fread($fp, filesize($block[content]));
                  fclose ($fp);
                  $block[content] = "?>$block[content]<?";
                  $block[content] = eval($block[content]);
          } else if (eregi("^http", $block[content])) {
                  $fp = fopen ($block[content], "r");
                  $block[content] = fread($fp, 65535);
                  fclose ($fp);
          }

Then create an HTML block containing the following url - change the bold text to match the information for your server.

http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php

phpNuke 5
You must modify the themesidebox() function of each theme where you want to use this block. You need to add the following code at the top of the themesidebox() function:

         if (@file_exists($content)) {
                $fp = fopen ($content, "r");
                $content = fread($fp, filesize($content));
                fclose ($fp);
                $content = "?>$content<?";
                $content = eval($content);
        } else if (eregi("^http", $content)) { 
                $fp = fopen ($content, "r"); 
                $content = fread($fp, 65535); 
                fclose ($fp); 
        }
        

Then create an HTML block containing the following url - change the bold text to match the information for your server.

http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Wed, 2004-07-28 22:51

The random block does not create any layout... it displays the image and the album name and nothing more. If HTML is missing, that's something you'll need to correct with your site configuration.

 
jdegrijs
jdegrijs's picture

Joined: 2004-03-15
Posts: 38
Posted: Mon, 2004-11-08 18:26

Is the "your-gallery-name" just "gallery" if I didn't change anything? Or is it the name which is displayed on the main gallery page? I used both, but nothing happens. Using both names didn't work out. http://jeffrey.degrijs.com/modules/gallery/block-random.php works

The code I entered in the php block:
if (pnModAvailable('gallery')) include("http://jeffrey.degrijs.com/modules.php?op=modload&name=gallery&file=index&include=block-random.php");
else
        echo ' ';

 
clothahump
clothahump's picture

Joined: 2002-11-26
Posts: 127
Posted: Thu, 2004-12-02 10:49
Quote:
phpNuke 7
Create a Core/PHP block with the following

All I get is the line of code showing in an extended block, where am I going wrong?

 
trevorh

Joined: 2005-02-17
Posts: 6
Posted: Thu, 2005-02-24 20:41

If i goit this right i just ad a sample block and put that code in it and change myserver and gallery name?

Photos should show up?

I get

Random Photos what i named the block.

The content you want in your new block goes here

Any help would be appreciated.

 
jdegrijs
jdegrijs's picture

Joined: 2004-03-15
Posts: 38
Posted: Thu, 2005-02-24 21:04

Sorry, I can't help you. Switched to Mambo months ago. PostNuke drove me mad.

 
Tommy237
Tommy237's picture

Joined: 2005-02-24
Posts: 21
Posted: Sun, 2005-02-27 10:13

Whether someone tell me, how I can use the random block if I use Mambo?

 
jdegrijs
jdegrijs's picture

Joined: 2004-03-15
Posts: 38
Posted: Sun, 2005-02-27 13:14

See http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=26336&sid=bb8a89b631b25b0e3be460e5ebe07499, but isn't working perfectly as I understand.

I have my template for chosing a random pic, not gallery.

 
Tommy237
Tommy237's picture

Joined: 2005-02-24
Posts: 21
Posted: Sun, 2005-02-27 13:44

Yea I have the module on my site, http://www.tommypavlik.polskiserwer.info
but it's not what I've been looking for.
The module has 2 bad sites:
- the first one is that I cannot indicate a patch to all gallery but only to one folder of images.
- the second one when I click on a random image, I don't get the same image in a full size, but I can only set in module configuration a path that can be used when I click a random image.
The bad sites cannot be accepted by me.
I've thought that there is any second method to put a random image block using the file "block-random" that You can find in gallery folder.
Are You sure that it ain't possible to use it?

Tommy

 
123Testing
123Testing's picture

Joined: 2005-03-16
Posts: 4
Posted: Wed, 2005-04-13 01:58

OK guys, I am lost at making this work with PostNuke .750 and Gallery 1.5-RC2.
I put the code as written in the 1st message and all I get is an empty block. Played around with the gallery name and the 'your.server' name and still nothing.
It must work cause there is one working on this site's home page... right?

Anyway, uh... help!

Thanks!

 
Not_Public
Not_Public's picture

Joined: 2002-12-13
Posts: 31
Posted: Tue, 2005-05-17 12:32

is it possible to resize an image with the existant random block?

or specify an album to pull random images from?

or can I make those feature requests for future tweaks?

(gallery 1.5 / postnuke .76rc4)

 
twopeak
twopeak's picture

Joined: 2005-05-22
Posts: 17
Posted: Tue, 2005-05-24 11:43

When I installed it standalone, it seemed to re-require some files.
I got a php error about "function is already declared" so I went into this block random and changed the require (.....
into require_once(.....

So this files do not get included once again if they have already been and they do get included if they haven't been included yet.

I was trying to include it in albums.php because I thought it would randomize the highlight pictures... (and thus it got included twice and made an error)

 
Viper_iii
Viper_iii's picture

Joined: 2002-12-31
Posts: 56
Posted: Tue, 2005-05-31 23:43
trevorh wrote:
If i goit this right i just ad a sample block and put that code in it and change myserver and gallery name?

Photos should show up?

I get

Random Photos what i named the block.

The content you want in your new block goes here

Any help would be appreciated.

Did you get this running?

What are you using? Post nuke or PHPNuke?

 
profius

Joined: 2005-06-09
Posts: 1
Posted: Thu, 2005-06-09 23:42

I have PhP Nuke 7.5

I create a block with this code inside: include("http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php");

It creates a block with the code text inside. On the other hand when I try it separately:

http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php

It gives me nice random picture.

So what I am doing wrong?

You can even try if you want:

http://wall.gwguards.com/modules.php?op=modload&name=gallery&file=index&include=block-random.php

Looks like something is wrong with the code that supposed to "attach" the code string to PHP.

 
speleo

Joined: 2005-06-14
Posts: 13
Posted: Tue, 2005-06-14 23:32

Long file names cause the mambo Gallery Random Block module to exceed the column width they are enclosed in. Anyone got any pointers on how to manipulate this to wrap the image text? You can't turn the filename text off either.

Is this something I can add in the parameters section of the module?

or do I need to muck around with CSS?

Any help most appeciated!!!

 
usmc_devildog

Joined: 2005-10-04
Posts: 3
Posted: Tue, 2005-10-04 19:10

I am not sure if anyone has tried this and been successful with Dragonfly. I have the gallery up and running (and working beautifully). However I am having issues with creating a block. The block text I have (as stated in the instructions, but tweaking it for use with Dragonfly) are as follows:

<?php

if (!defined('CPG_NUKE')) { exit; }

ob_start();
include( 'http://www.intothemind.com/index.php?name=gallery&file=index&include=block-random.php' );

$content = '<div align="center">';
$content = ob_get_clean();
$content .= '</div>';

?>

However no picture is shown. But if I go to that URL the random image/caption is generated just fine. If I used the following as the "include" then it pulls the image/caption but gets errors when trying to go to that picture/album (with LEO turned on/off):

include( 'modules/gallery/block-random.php' );

Is there a certain way this file needs to be included for it to work properly in Dragonfly CMS? Any assistance would be greatly appreciated =)

Normalcy is the playground of the unimaginative

 
digitaldemigod

Joined: 2005-10-06
Posts: 1
Posted: Thu, 2005-10-06 20:16

I was struggling with the info provided here too and I went and look at the "how to" on phpnuke.org and a combination of the two got me working.

I am using nuke 7.5 and gallery 1.4.4. Here's my working code.

<?php
if (eregi("block-RandomGallery.php",$_SERVER[PHP_SELF])) {
Header("Location: index.php");  
die(); 
}

ob_start(); 
include("http://www.servernamehere.com/nuke/modules.php?op=modload&name=gallery-name-here&file=index&include=block-random.php");
$output = ob_get_contents();
ob_end_clean(); 
$content = $output;


?>

You can see this working at http://www.myworldofwarcraft.com

 
Xepha

Joined: 2005-07-29
Posts: 8
Posted: Tue, 2005-10-25 17:39
123Testing wrote:
OK guys, I am lost at making this work with PostNuke .750 and Gallery 1.5-RC2.
I put the code as written in the 1st message and all I get is an empty block. Played around with the gallery name and the 'your.server' name and still nothing.

I'm using Gallery (v. 1.5.1) embedded into PostNuke (v. 0.75b) and I got a blank block unless I ONLY put this part into the block:

Quote:
include("http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php");

I only have one problem though. I have all albums except for one set so that only logged-in users can view the photos. My guest viewable album only has one picture in it. This guest viewable album/photo is the only one that ever shows up in the random block, even if I'm logged in as a normal user or an admin.

Is there any way I can allow it to pull thumbnails from any album? I don't mind if non-logged-in guests can view thumbnails from restricted albums, as long as that somehow doesn't give them full viewing access to the album when they click on it, but it's ok if guests cannot view thumbnails from restricted albums as long as logged-in users can view them.

 
Viper_iii
Viper_iii's picture

Joined: 2002-12-31
Posts: 56
Posted: Thu, 2006-01-05 21:04

I have had this working and recently had to deny because of excessive traffic.... I denied the site the ability to redirect to itself apparently...LOL

It has eliminated my max mysql requests problem with postnuke and that is now solved... but now My random block won't work...

is the code not clean? is it getting into a constant loop of some sort?

It had approximately 30k hits from itself with merely 1300 visitors so far... wtf.. what have I done...

Using Postnuke 761
gallery 1.5.1
Pnphpbb2 12g + patches
Ipower Hosting (yeah I know Ipower isn't the best)
www.oceanodunes.org
let me know what you think of the error when inside the gallery or forums... it doesn't error on the index only inside the site... Like here http://oceanodunes.org/beta/index.php?name=Gallery&include=albums.php

 
ABitDifferent

Joined: 2006-01-06
Posts: 1
Posted: Mon, 2006-02-13 17:32
Quote:
standalone
Add the following to your PHP-based pages:
include('http://your.server/gallery/block-random.php');

Someone want to be a bit more descriptive on this one for me. There are over 100 php files and I have only looked in two folders. I am guessing that number will raise well past 200 php files in all. Which files need this added?

Also what exacly is this script going to do? I am looking to have random ordered gallies, random highlights, and random image order. Is this the purpose of the script?

 
ddhoray

Joined: 2006-04-17
Posts: 1
Posted: Thu, 2006-04-20 17:50

I can't find the block-random.php file? Does this come by default with the gallery or do I have to create it?
Any help here is appreciated.

 
Photolythic

Joined: 2006-04-16
Posts: 2
Posted: Wed, 2006-04-26 15:43
ABitDifferent wrote:
Quote:
standalone
Add the following to your PHP-based pages:
include('http://your.server/gallery/block-random.php');

Someone want to be a bit more descriptive on this one for me. There are over lasik operation 100 php files and I have only looked in the folders. I am guessing that number will raise well past 200 php jamaica vacation files in wandel vakantie all. Which files need this added?

Also what exacly is this script going to do? I am looking to have random ordered , random highlights, and accountant mkb random image order. Is this the purpose of the script?

Well you don't have to do all the searching yourself.

 
Andy Summer

Joined: 2006-03-25
Posts: 18
Posted: Fri, 2006-04-28 10:25
ddhoray wrote:
I can't find the blockrandom.php file? Does this come by default with the gallery or do I have to create it?
Any help here is appreciated.

Same problem here, any help someone?

 
DavidPook

Joined: 2006-05-04
Posts: 11
Posted: Sun, 2006-09-03 22:36

Guys....... Does ANYONE have a solution for having a random block of images for either postnuke site or a MDPro website ?

Followed the instructions at the top of this topic but couldnt get it to work for me. I know that i had to change the filename to gallery_random.php when entering in my information in the code section, I also had to add $safe URL into my gallery index.php file. Did all of this but still..........NO image showed up !!!!!

PLEASE, would someone give me some help and I am sure it will ALSO benefit others here which have gone without a random block for some time now.

Thanks in advance

 
mephisto37

Joined: 2006-09-25
Posts: 1
Posted: Mon, 2006-09-25 15:28

This may help someone. Im running Gallery 1.5.3 and PhpNuke 7.5.

1. Create a file called "block-random.php" in your notepad.
2. Insert the code below:

Quote:
<?php

if (eregi("block-random.php",$_SERVER[PHP_SELF])) {
Header("Location: ../index.php");
die();
}

ob_start();
include("http://www.yourserver/modules.php?op=modload&name=gallery&file=index&include=block-random.php");
$output = ob_get_contents();
ob_end_clean();
$content = "<center>$output";

?>

3. Upload the file to your "blocks" folder at your webserver.
4. Go to the admin panel in phpNuke and create a new block by selecting the "random" file.
5. The random image block should now be working.

Good luck

 
agent_dave79

Joined: 2007-05-08
Posts: 2
Posted: Thu, 2007-05-10 09:01

is there an official way to make the random block select pictures only from a specifiv album? all posts on that subject are a bit confusing.

maybe you could include that into your installing instructions? might help many people and avoid several posts.

thx for your help
dave

 
ataru

Joined: 2007-12-01
Posts: 3
Posted: Sat, 2007-12-08 17:11

OK, is there a way to do this with basic PHP? As in, enter Dreamweaver, create a PHP file, write PHP code to display random images. I'm not on PostNuke or anything.