PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
srhh
Involved
Involved


Joined: Dec 27, 2005
Posts: 296

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

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 Back to top

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
View user's profile Send private message Visit poster's website
srhh
Involved
Involved


Joined: Dec 27, 2005
Posts: 296

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

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
View user's profile Send private message
srhh
Involved
Involved


Joined: Dec 27, 2005
Posts: 296

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

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)
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum