Hello all !
I have set up a small code (below) to extract the last three albums informations from a category. It shows in a three cells table the thumbnail picture (this is the problem), a link from the picture to the relevant album, number of pictures in the album, and the description of the album. This works fine (nearly, see below) !
I know i can achieve a better code but this works fine, and will do it later ... This can be seen at www.florennes-as.be (http://www.florennes-as.be)
In Copperimne you can select the thumb of an album (amongst all thumb's album, in album/properties) which will represent the album in albums lists. I select the best shot thumb, of course ...
When the call to cpm_viewLastUpdatedAlbumsFrom is done, cpm does not get the selected album's thumb (under copperimne's album properties) but the last thumb of the album. I would like to have the selected thumb instead of the last one ...
This little detail is important for us, and i guess for some other people ...
Have i missed something ?
Any clues very much appreciated ! ;-)
All my thanks for people behind cpmfetch !!!
L@urent
<?php
include "./engine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./engine/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setReturnType ("resultset");
$table = $objCpm->cpm_viewLastUpdatedAlbumsFrom("cat=2",3,1,$options);
?>
<body>
<table width="380" border="0">
<tr>
<TD>
<div align="center"><img src="/toolbox/welcome/lastthreeflorennes.png" width="272" height="20"></p>
</tr>
</TD>
<table width="380" border="0">
<tr>
<? $lien = "http://www.florennes-as.be/engine/thumbnails.php?album=" . $table[0][aAid] ; ?>
<td colspan="2"><div align="center"><? echo "<a href=\" ". $lien . "\" target=\"_blank\">" . $table[0]["aTitle"] . "<a><br>" ; ?></td>
</tr>
<tr>
<td width="202" height="135"><? echo "<a href=\" ". $lien . "\" target=\"_blank\">" . "<img src=\" " . "engine/" . $table[0]["fullPathToThumb"] . "\" /></a>" ; ?></td>
<td><? $numb = $objCpm->cpm_getMediaCountForAlbum($table[0][aAid]) ; ?>
<? echo "Picture Number : " . $numb ; ?>
<br />
<br />
<? echo $table[0]["aDescription"] ; ?></td>
</tr>
<tr>
<? $lien = "http://www.florennes-as.be/engine/thumbnails.php?album=" . $table[1][aAid] ; ?>
<td colspan="2"><div align="center"><? echo "<a href=\" ". $lien . "\" target=\"_blank\">" . $table[1]["aTitle"] . "<a><br>" ; ?></td>
</tr>
<tr>
<td width="202" height="135"><? echo "<a href=\" ". $lien . "\" target=\"_blank\">" . "<img src=\" " . "engine/" . $table[1]["fullPathToThumb"] . "\" /></a>" ; ?></td>
<td><? $numb = $objCpm->cpm_getMediaCountForAlbum($table[1][aAid]) ; ?>
<? echo "Picture Number : " . $numb ; ?>
<br />
<br />
<? echo $table[1]["aDescription"] ; ?></td>
</tr>
<tr>
<? $lien = "http://www.florennes-as.be/engine/thumbnails.php?album=" . $table[2][aAid] ; ?>
<td colspan="2"><div align="center"><? echo "<a href=\" ". $lien . "\" target=\"_blank\">" . $table[2]["aTitle"] . "<a><br>" ; ?></td>
</tr>
<tr>
<td width="202" height="135"><? echo "<a href=\" ". $lien . "\" target=\"_blank\">" . "<img src=\" " . "engine/" . $table[2]["fullPathToThumb"] . "\" /></a>" ; ?></td>
<td><? $numb = $objCpm->cpm_getMediaCountForAlbum($table[2][aAid]) ; ?>
<? echo "Picture Number : " . $numb ; ?>
<br />
<br />
<? echo $table[2]["aDescription"] ; ?></td>
</tr>
</table>
<?php
$objCpm->cpm_close();
?>
</body>
cpmfetch_dao.php, function getLastUpdatedAlbumsFrom()
find
$sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect . " FROM "
. $this->sqlTableSelect ." LEFT JOIN "
. $this->cfg['table_prefix'] . "pictures AS p2 ON p.aid = p2.aid and p.ctime < p2.ctime "
. " WHERE p2.pid is NULL "
. $this->sqlUserDataLink
. $this->filetypefilter
. " AND p.approved='YES' "
. $sourceSql
. " {$this->privacyfilter} "
. " GROUP BY p.aid "
. " ORDER BY p.ctime DESC LIMIT 0,$count";
change to
$sqlcode = "SELECT {$this->sqlPostSelect} " . $this->sqlSelect . " FROM "
. $this->sqlTableSelect ." LEFT JOIN "
. $this->cfg['table_prefix'] . "pictures AS p2 ON p.aid = p2.aid and p.ctime < p2.ctime "
. " WHERE (p2.pid is NULL OR p.pid = a.thumb) "
. $this->sqlUserDataLink
. $this->filetypefilter
. " AND p.approved='YES' "
. $sourceSql
. " {$this->privacyfilter} "
. " GROUP BY p.aid "
. " ORDER BY (p.pid = a.thumb) DESC, p.pid DESC LIMIT 0,$count";
Many thanks ! This worked fine !!!
I realised i forgot to thank you, shame on me !!!
L@urent
Hello !
After several weeks of use, all works fine except the last albums are not well ordered.
Most of the time, it is okay. I have started a new album, and it is not showed on top of the list ... strange isn't it ?
In fact, i had three albums, correctly ordered by descending date.
I have now added a new album, it should be showed on top of list, but it is not, and i still have the same "first" three albums ...
Can you help me ? Many thanks in advance,
L@urent
When looking at the slight modification of the code ... Is it due to the "p.ctime DESC" removed on the "order by" ?
L@urent
Well, i solved the problem ...
Initially, I made a new album, put it in top of the list and uploaded by FTP, added by ftp=> and the result was cpmfetch did not saw it (on first place).
I solved it when I deleted a picture of the newly created album via coppermine, and added it again by ftp=> then now, the gallery is in top in cpmfetch.
L@urent