Last updated albums Last updated albums
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Last updated albums

Started by anna., October 09, 2008, 03:42:36 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

anna.

I hate doing new topics because I feel like the answer is out there and I missed it even though I've searched, read and tried lots of things with no success, so I hope you can help me with this. I'm not very good with php so maybe that's why I haven't succeded :/

What I want to do is show the last updated albums, I'm using listMediaAddedOverLastDays but obviously if I don't updated the gallery for a certain number of days the list disappear and if I put more days it'll show a long list of updated albums. Is it possible to just show a certain number of last updated albums (or last added media)?

anna.

ok, since there was no answer I had to venture myself into this even more, and after so many days and hours of reserching and trial and error I managed to get what I wanted, I'll post it here so others can see it and use it if they want.

I first changed in cpmfetch_dao.php this:

function getMediaAddedSince ($timestamp) {
$retval = "";
if (is_numeric($timestamp)) {
$sqlcode = 'SELECT ' . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
// . " WHERE p.aid = a.aid AND a.category = c.cid "
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' $this->privacyfilter AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY c.name, p.mtime';

$retval = $this->dbExecuteSql($sqlcode);
}

return($this->covertResultsetToArray($retval));
}

into this:
function getMediaAddedSince ($timestamp) {
$retval = "";
if (is_numeric($timestamp)) {
$sqlcode = 'SELECT ' . $this->sqlSelect
. ', c.name AS cName, count( p.pid ) AS count '
. ' FROM '
. $this->sqlTableSelect
// . " WHERE p.aid = a.aid AND a.category = c.cid "
. " WHERE a.category = c.cid "
. $this->sqlUserDataLink
. " AND p.approved='YES' $this->privacyfilter AND p.ctime > " . $timestamp
. ' GROUP BY a.category, a.aid'
. ' ORDER BY p.ctime DESC';

$retval = $this->dbExecuteSql($sqlcode);
}

return($this->covertResultsetToArray($retval));
}


So it shows/lists the albums last updated/created and not by alphabetic order.

and then this is the code I used to show the list:


<?php
include "./photos/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./photos/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setReturnType("resultset");
$data $objCpm->cpm_showAlbumsUpdatedOverLastDays(100);

$cnt 0;
$albumstoshow 5;
$arrayofalbums = array();

foreach ($data as $row) {
if (! in_array($row['aTitle'],$arrayofalbums)) {
print "<table><tr>";
print "<td>";
print "<a href=\"/photos/displayimage.php?pos=-{$row['pPid']}\" target=\"_blank\"><img src=\"/photos/albums/{$row['pFilepath']}/thumb_{$row['pFilename']}\" width=\"40\"></A>";
print "</td>";
print "<td>";
print "<b>{$row['count']}</b> new pictures in<br><a href=\"/photos/thumbnails.php?album={$row['pAid']}\" target=\"_blank\">";
print $row['aTitle']. "</a><br>\n";
print "</td>";
print "</tr></table>";
array_push($arrayofalbums,$row['aTitle']);
$cnt++;
if ($cnt == $albumstoshow) break;
}
}
$objCpm->cpm_close();
?>





Maybe there's and easy way, or this is not completely right but it works for me, so yeah. You can see how it looks here: http://canon-love.co.uk/ (on the left sidebar)

phileuf

Great...

Your post is very important for me.

I understand the first part, but I don't known where you put the second code for showing the pictures.

Thanks for your help

PS: sorry for my poor english  ;)

phileuf

My problem is, perhaps, because I work with Joomla (with medhi's bridge, of course) ?

phileuf

It's ok...

With the module nammed Jumi (http://jumi.vedeme.cz), I can put php in Joomla  ;D

Bye

Joachim Müller

You might want to read the board rules and the sticky threads to figure out why nobody will reply to your postings. Locking