C'est bon j'ai ce qui me faut !
Je me suis basé sur le mod d'EasyJava (
qu'on retrouve ici) et sur le plugin
Photo of the Day/Week, with Archive. Le premier ne permet pas d'intégrer facilement la photo du jour à la page d'accueil et le deuxième me fait "bugguer" la galerie...
Donc c'est parti !
D'abord on créé une table de plus :
CREATE TABLE `prefixe_jour_semaine` (
`pid` int(11) NOT NULL default '0',
`date` varchar(14) collate latin1_german1_ci NOT NULL default '',
PRIMARY KEY (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci;
où prefixe est évidemment votre préfixe.
Ensuite on va modifier init.inc.php. Recherchez
$CONFIG['TABLE_HIT_STATS'] = $CONFIG['TABLE_PREFIX'].'hit_stats';
Ensuite ajoutez
/////////////////////////////////////////////////////////// MOD Photo/Jour/Semaine by Elwood J. Blues /////////////////////////
$CONFIG['TABLE_JOUR_SEMAINE'] = $CONFIG['TABLE_PREFIX'].'jour_semaine';
/////////////////////////////////////////////////////////// MOD Photo/Jour/Semaine by Elwood J. Blues /////////////////////////
Après ouvrez le fichier index.php. Recherchez
case 'anycontent':
if ($cat == 0) {
ob_start();
/**
* Any php code or HTML can be put in this file and will be displayed
*/
include('anycontent.php');
$anycontent = CPGPluginAPI::filter('anycontent',ob_get_contents());
ob_end_clean();
echo ($anycontent);
}
flush();
break;
Après ajoutez :
/////////////////////////////////////////////////////////// MOD Photo/Jour/Semaine by Elwood J. Blues /////////////////////////
case 'photojour':
$result = cpg_db_query("SELECT photos.pid as pid, aid, filepath, filename, owner_name, owner_id FROM {$CONFIG['TABLE_JOUR_SEMAINE']} AS jour, {$CONFIG['TABLE_PICTURES']} AS photos WHERE photos.pid=jour.pid AND jour.date = '".date("Y-m-d")."'");
$photo_jour = mysql_fetch_assoc($result);
$tot = mysql_num_rows($result);
mysql_free_result($result);
if($tot == 0){
$resultat = cpg_db_query("SELECT pid, aid, filepath, filename, owner_name, owner_id FROM {$CONFIG['TABLE_PICTURES']} ORDER BY RAND() LIMIT 1 ");
$photo_jour = mysql_fetch_array($resultat);
mysql_free_result($resultat);
$sql = cpg_db_query("INSERT INTO {$CONFIG['TABLE_JOUR_SEMAINE']} (date, pid) VALUES ('".date("Y-m-d")."', '".$photo_jour["pid"]."')");
}
$fichier = "albums/".$photo_jour['filepath']."normal_".$photo_jour['filename'];
if (file_exists($fichier)){
$image = "albums/{$photo_jour['filepath']}normal_{$photo_jour['filename']}";
}
else {
$image = "albums/{$photo_jour['filepath']}{$photo_jour['filename']}";
}
echo " <img src=\"images/spacer.gif\" width=\"1\" height=\"7\" border=\"\" alt=\"\" /><br />
<table align=\"center\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" class=\"maintable\">
<tr>
<td class=\"tableh1\" align=\"center\"><span class=\"statlink\">Photo du Jour</span></td>
</tr>
<tr>
<td align=\"center\"><a href=\"displayimage.php?pos=-{$photo_jour['pid']}\"><img src=\"$image\" border=\"0\"></a><br />
Par<b>
<a href=\"thumbnails.php?album=lastupby&uid={$photo_jour['owner_id']}\">{$photo_jour['owner_name']}</a></b><br />
</td>
</tr>
</table>
";
break;
case 'photosemaine':
$result = cpg_db_query("SELECT photos.pid as pid, aid, filepath, filename, owner_name, owner_id FROM {$CONFIG['TABLE_JOUR_SEMAINE']} AS semaine, {$CONFIG['TABLE_PICTURES']} AS photos WHERE photos.pid=semaine.pid AND semaine.date = '".date("W-Y")."'");
$photo_semaine = mysql_fetch_assoc($result);
$tot = mysql_num_rows($result);
mysql_free_result($result);
if($tot == 0){
$resultat = cpg_db_query("SELECT pid, aid, filepath, filename, owner_name, owner_id FROM {$CONFIG['TABLE_PICTURES']} ORDER BY RAND() LIMIT 1 ");
$photo_semaine = mysql_fetch_array($resultat);
mysql_free_result($resultat);
$sql = cpg_db_query("INSERT INTO {$CONFIG['TABLE_JOUR_SEMAINE']} (date, pid) VALUES ('".date("W-Y")."', '".$photo_semaine["pid"]."')");
}
$fichier = "albums/".$photo_jour['filepath']."normal_".$photo_jour['filename'];
if (file_exists($fichier)){
$image = "albums/{$photo_jour['filepath']}normal_{$photo_jour['filename']}";
}
else {
$image = "albums/{$photo_jour['filepath']}{$photo_jour['filename']}";
}
echo " <img src=\"images/spacer.gif\" width=\"1\" height=\"7\" border=\"\" alt=\"\" /><br />
<table align=\"center\" width=\"100%\" cellspacing=\"1\" cellpadding=\"0\" class=\"maintable\">
<tr>
<td class=\"tableh1\" align=\"center\"><span class=\"statlink\">Photo de la Semaine</span></td>
</tr>
<tr>
<td align=\"center\"><a href=\"displayimage.php?pos=-{$photo_semaine['pid']}\"><img src=\"$image\" border=\"0\"></a><br />
Par<b>
<a href=\"thumbnails.php?album=lastupby&uid={$photo_semaine['owner_id']}\">{$photo_semaine['owner_name']}</a></b><br />
</td>
</tr>
</table>
";
break;
/////////////////////////////////////////////////////////// MOD Photo/Jour/Semaine by Elwood J. Blues /////////////////////////
Enfin dans votre panneau de configuration, Affichage de la liste des albums, Le contenu de la page principale, vous pouvez ajouter photojour ou photosemaine ou les deux dans l'ordre que vous voulez !
Petit exemple en fichier joint !
Enjoy