Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks
Author Message
srhh
Involved
Involved



Joined: Dec 27, 2005
Posts: 296

PostPosted: Wed Mar 01, 2006 7:40 pm Reply with quote

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 
View user's profile Send private message
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Thu Mar 02, 2006 8:31 am Reply with quote

Try changing where the load script is included
Code:


$cpg_dir = "coppermine";

$cpg_block = true;
require("modules/" . $cpg_dir . "/include/load.inc.php");


I don't know if it will work or not

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
srhh







PostPosted: Thu Mar 02, 2006 9:54 am Reply with quote

No, didn't seem to work. I changed the directory to the URL where it is at and just gave me a semi-blank screen after uploading the block. Sad
 
srhh







PostPosted: Tue Mar 07, 2006 6:43 pm Reply with quote

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.. Sad
It just shows the text of the code in the block. (Which is better than a blank screen)
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Blocks

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
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©