Advanced search  

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

Pages: [1]   Go Down

Author Topic: Last updated albums  (Read 11276 times)

0 Members and 1 Guest are viewing this topic.

anna.

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 16
    • Canon Love
Last updated albums
« on: October 09, 2008, 03:42:36 am »

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)?
Logged

anna.

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 16
    • Canon Love
Re: Last updated albums
« Reply #1 on: October 23, 2008, 04:58:23 am »

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:
Code: [Select]
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:
Code: [Select]
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:

Code: [Select]
<?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)
Logged

phileuf

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Last updated albums
« Reply #2 on: October 31, 2008, 09:04:55 am »

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  ;)
Logged

phileuf

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Last updated albums
« Reply #3 on: October 31, 2008, 09:07:07 am »

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

phileuf

  • Coppermine newbie
  • Offline Offline
  • Posts: 9
Re: Last updated albums
« Reply #4 on: October 31, 2008, 01:19:40 pm »

It's ok...

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

Bye
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Last updated albums
« Reply #5 on: October 31, 2008, 03:35:08 pm »

You might want to read the board rules and the sticky threads to figure out why nobody will reply to your postings. Locking
Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 19 queries.