PHPNuke 7.6 Random Photo Block

Water_Dude

Joined: 2005-01-16
Posts: 3
Posted: Sun, 2005-01-16 19:39

To get it to work with PHPNuke 7.6 required a couple (3) small modifications.
First I inserted this code from the sample block (I had renamed the file).

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

Then I changed the "echo" to "$content .=" in the following lines.

if (!empty($index)) {
	$id = $album->getPhotoId($index);
	$content .= ""
		. "<center><a href=" . makeAlbumUrl($album->fields["name"], $id) . ">"
		. $album->getThumbnailTag($index)
		. "</a></center>";

	$caption = $album->getCaption($index);
	if ($caption) {
		$content.= "<br><center>$caption</center>";
	}

	$content .= "<br><center>From: "
		."<a href=" .makeAlbumUrl($album->fields["name"]) .">"
		.$album->fields["title"]
		."</a></center>";
} else {
	$content .= "<center>No photo chosen.</center>";
}

Third thing I had to change my php.ini file to allow more than 8M of memory for PHP. Because of all the pictures on the site it required more than 8 mb to create the dat file.

Quote:
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 20M ; Maximum amount of memory a script may consume (8MB)

Enjoy. :D [/code]