I installed Coppermine via Fantastico onto my server and it is in a different directory and different database than my Nuke site. I'd like to add some blocks for CPG onto my Nuke site. Any way to go about this? Here is an example block code for showing the latest pics added:
Code:
if (eregi("block-CPG-Last_pictures_thumb.php", $_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
define('NO_HEADER', true);
global $prefix, $db, $CONFIG, $Version_Num, $cpg_dir;
//global $ALBUM_SET;
$cpg_dir = "coppermine";
$cpg_block = true;
require("modules/" . $cpg_dir . "/include/load.inc.php");
$cpg_block = false;
$length = $CONFIG['thumbcols']; //number of thumbs
// $length=4; //number of thumbs
$title_length = 15; // maximum length of title under pictures, 20 is default
$content = '';
$content = '<p align="center">';
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved='YES' GROUP BY pid ORDER BY pid DESC LIMIT $length");
while ($row = $db->sql_fetchrow($result)) {
if ($CONFIG['seo_alts'] == 0) {
$thumb_title = $row['filename'];
} else {
if ($row['title'] != '') {
$thumb_title = $row['title'];
} else {
$thumb_title = substr($row['filename'], 0, -4);
}
}
stripslashes($thumb_title);
$content .= '<a href="' . $CPG_M_URL . '&file=displayimage&pos=-' . $row["pid"] . '"><img src="' . $row["filepath"] . $CONFIG["thumb_pfx"] . $row["filename"] . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '"><br>' . truncate_stringblocks($thumb_title, $title_length) . '</a><br>';
}
$content .= '<br><br><a href="' . $CPG_M_URL . '">' . $lang_pagetitle_php["photogallery"] . '</a></p>';
?>
Last edited by srhh on Tue Mar 07, 2006 6:44 pm; edited 1 time in total
Ok, so I found a nifty little add-on for Coppermine called cpmfetch. You upload it to your website and it handles spitting out php and html to show pics from Coppermine on any webpage you want. Now the only issue is getting the php to work in a block! Here is the PHP that cpmfetch gives to show a random image:
Code:
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(3,3);
$objCpm->cpm_close();
?>
and here is that PHP I tried when it is churned through Block Creator:
Code:
<?php
#### Generated by Block Creator by Disipal Site (www.disipal.net) ###
if (eregi("block-Block_Creator.php",$PHP_SELF)) {
Header("Location: index.php");
die();
}
$content = "<?php ";
$content .= "include \"./cpmfetch/cpmfetch.php\";";
$content .= "objCpm = new cpm(\"/gallery\");";
$content .= "objCpm->cpm_viewRandomMedia(3,3);";
$content .= "objCpm->cpm_close();";
$content .= "> ";
?>
It doesn't work..
It just shows the text of the code in the block. (Which is better than a blank screen)
View next topic View previous topic
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum