Content displayed by a plugin on a separate page? Content displayed by a plugin on a separate page?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Content displayed by a plugin on a separate page?

Started by dke, January 14, 2008, 08:22:20 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dke

Hi,

I'm trying to get update history ver 1.1. (http://forum.coppermine-gallery.net/index.php?topic=38148.0) to be displayed on its own tab. Where do i begin trying to wrap only this plugin into its own page within the gallery? The reason i want to do this is because on my large database (200 000+ images) it really kills the load time (and burn cpu cycles on the server) for the index page, however its a nice feature to have. So id like to still enable users to use it, but they would have to click a tab (button) to see it.

Anyone have a guide or who could point me in the direction? I tried to search the forums but came up with nothing.

Thanks!

Stramm



dke

Sorry for the double post, can you help me understand how to get the script to load inside coppermine?

This is the code: <?php
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.4.0                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR                                     //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// $Id: anycontent.php,v 1.9 2004/08/02 08:15:13 gaugau Exp $
// ------------------------------------------------------------------------- //

/**
* Coppermine Photo Gallery 1.3.0 anycontent.php
*
* This file file gets included in the index.php if you set the option in config
* can be used to display any content from any program, it is always to be edited
* according to tastes and then used
*
* @copyright 2002,2003 Gregory DEMAR, Coppermine Dev Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License V2
* @package Coppermine
* @version $Id: anycontent.php,v 1.9 2004/08/02 08:15:13 gaugau Exp $
*/

/* Days ago to start history */
$days 7;

$end time();
$counter = array();
$info = array();
$FORBIDDEN_SET_UPD = ($FORBIDDEN_SET) ? "AND $FORBIDDEN_SET'';

echo 
'<br />';
starttable("100%""Updates");

for (
$d 0$d $days$d++) {
$start strtotime(date("Ymd")) - ($d*60*60*24);
$result db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid)  AND (ctime BETWEEN $start AND $end$FORBIDDEN_SET_UPD ORDER BY ctime DESC");
while ($row mysql_fetch_assoc($result)) {
$day date("F jS",$row['ctime']);
$counter[$day][$row[album_title]] += 1;
$info[$day][$row[album_title]] = $row;
$users[$day][$row[album_title]][] = $row['owner'];
}
$end $start;
}

$i 0;
$test array_keys($counter);

foreach (
$counter as $day) {
foreach ($day as $album => $number) {
$date $test[$i];
$album_info $info[$date][$album];
echo '<tr><td class="tableb">' .$date": $number new pic".(($number 1) ? 's' '')." uploaded into album '<a href=\"thumbnails.php?album={$album_info['aid']}\">$album</a>' by ";
$links = array();
foreach ($users[$date][$album] as $u) {
if ($u 0$links[] = "<a href=\"profile.php?uid=$u\">"get_username($u) ."</a>";
}
$out array_unique($links);
echo implode(', ',$out);
echo "</td></tr>";
}
$i++;
}
endtable();
?>


However if i put a php file in my coppermine root directory and try to open it, i get a blank page.

I assume i have to add code: define('IN_COPPERMINE', true); at the beginning of the code?

That still dosn't make the script load, what am i doing wrong?

dke

Some progression.

The code above is not for 1.4, thats probably why it didn't give any results?

Now i have a code that generate result but it's still not getting wrapped into the coppermine theme, i miss the buttons (on top) and much of the layout , however the generation of content is correct, whats missing?

<?php
define
('IN_COPPERMINE'true);
define('ANYCONTENT3_PHP'true);

require(
'include/init.inc.php');
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.4.x                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR modified by deejaymoni    //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// $Id: anycontent.php,v 1.9 2004/08/02 08:15:13 gaugau Exp $
// ------------------------------------------------------------------------- //

/**
* Coppermine Photo Gallery 1.4.x anycontent.php
*
* This file file gets included in the index.php if you set the option in config
* can be used to display any content from any program, it is always to be edited
* according to tastes and then used
*
* @copyright 2002,2003 Gregory DEMAR, Coppermine Dev Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License V2
* @package Coppermine
* @version $Id: anycontent.php,v 1.9 2004/08/02 08:15:13 gaugau Exp $
*/

/* Days ago to start history */
$days 4;

$end time();
$counter = array();
$info = array();
$FORBIDDEN_SET_UPD = ($FORBIDDEN_SET) ? "AND $FORBIDDEN_SET'';

echo 
'<br />';
starttable("100%""Updates");
echo '<tr><td class="tableh1"><b><b>Todays updates</b></td></tr>';

for (
$d 0$d $days$d++) {
$start strtotime(date("Ymd")) - ($d*60*60*24);
$result cpg_db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid)  AND (ctime BETWEEN $start AND $end$FORBIDDEN_SET_UPD ORDER BY ctime DESC");
while ($row mysql_fetch_assoc($result)) {
$day date("F jS",$row['ctime']);
$counter[$day][$row[album_title]] += 1;
$info[$day][$row[album_title]] = $row;
$users[$day][$row[album_title]][] = $row['owner'];
}
$end $start;
}

$i 0;
$test array_keys($counter);

foreach (
$counter as $day) {
foreach ($day as $album => $number) {
$date $test[$i];
$album_info $info[$date][$album];
echo '<tr><td class="tableb">' .$date": $number new pic".(($number 1) ? 's' '')." uploaded into album '<a href=\"thumbnails.php?album={$album_info['aid']}\">$album</a>' by ";
$links = array();
foreach ($users[$date][$album] as $u) {
if ($u 0$links[] = "<a href=\"profile.php?uid=$u\">"get_username($u) ."</a>";
}
$out array_unique($links);
echo implode(', ',$out);
echo "</td></tr>";
}
$i++;
}
endtable();
?>


Thank you in advance!

Stramm

define('IN_COPPERMINE', true);
require('include/init.inc.php');
pageheader('Update History');


that's the necessary things, pagehader renders the menu etc

dke

Thank you stramm, can put solved on this!

This code worked for my gallery 1.4.x

Quote<?php
define('IN_COPPERMINE', true);
define('UPDATEHISTORY_PHP', true);

require('include/init.inc.php');

pageheader('Recent update history');
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery 1.4.x                                            //
// ------------------------------------------------------------------------- //
// Copyright (C) 2002-2004 Gregory DEMAR modified by deejaymoni    //
// http://www.chezgreg.net/coppermine/                                       //
// ------------------------------------------------------------------------- //
// Updated by the Coppermine Dev Team                                        //
// see /docs/credits.html for details                                        //
// ------------------------------------------------------------------------- //
// This program is free software; you can redistribute it and/or modify      //
// it under the terms of the GNU General Public License as published by      //
// the Free Software Foundation; either version 2 of the License, or         //
// (at your option) any later version.                                       //
// ------------------------------------------------------------------------- //
// $Id: anycontent.php,v 1.9 2004/08/02 08:15:13 gaugau Exp $
// ------------------------------------------------------------------------- //

/**
* Coppermine Photo Gallery 1.4.x anycontent.php
*
* This file file gets included in the index.php if you set the option in config
* can be used to display any content from any program, it is always to be edited
* according to tastes and then used
*
* @copyright 2002,2003 Gregory DEMAR, Coppermine Dev Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License V2
* @package Coppermine
* @version $Id: anycontent.php,v 1.9 2004/08/02 08:15:13 gaugau Exp $
*/

/* Days ago to start history */
$days = 4;

$end = time();
$counter = array();
$info = array();
$FORBIDDEN_SET_UPD = ($FORBIDDEN_SET) ? "AND $FORBIDDEN_SET" : '';

echo '<br />';
starttable("100%", "Recent update history");

for ($d = 0; $d < $days; $d++) {
   $start = strtotime(date("Ymd")) - ($d*60*60*24);
$result = cpg_db_query("SELECT *,a.title AS album_title,p.owner_id AS owner FROM {$CONFIG['TABLE_PICTURES']} AS p,{$CONFIG['TABLE_ALBUMS']} AS a WHERE (APPROVED ='YES') AND (p.aid = a.aid)  AND (ctime BETWEEN $start AND $end) $FORBIDDEN_SET_UPD ORDER BY ctime DESC");
   while ($row = mysql_fetch_assoc($result)) {
      $day = localised_date($row['ctime'],$album_date_fmt);
      $counter[$day][$row[album_title]] += 1;
      $info[$day][$row[album_title]] = $row;
      $users[$day][$row[album_title]][] = $row['owner'];
   }
   $end = $start;
}

$i = 0;
$test = array_keys($counter);

foreach ($counter as $day) {
   foreach ($day as $album => $number) {      
      $date = $test[$i];
      $album_info = $info[$date][$album];      
      echo '<tr><td class="tableb">' .$date. ": $number new pic".(($number > 1) ? 's' : '')." uploaded into album <a href=\"thumbnails.php?album={$album_info['aid']}\">$album</a>";
      $links = array();

      $out = array_unique($links);
      echo implode(', ',$out);
      echo "</td></tr>";
   }
   $i++;
}
endtable();
?>
<br>