Przedszkolak
Postów: 8 Ostrzeżeń: 3
Data rejestracji: 16.05.2009 12:06
|
Witam serdecznie
chciałbym osiągnąć taki efekt na stronie głównej
nic mi z tego nie wychodzi podam kod
<?php
/*---------------------------------------------------+
| Picture of the Day Infusion
| PHP-Fusion (c) 2005 Nick Jones
+----------------------------------------------------+
| Copyright (c) 2006 Adnan Ahmed
|
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
/* Spolszczenie - jantom - http://jantom.info */
//Picture of the day
opentable("Produkt dnia!");
echo "<table><tr><td>";
define("SAFEMODE", @ini_get("safe_mode") ? true : false);
$presult = dbquery("SELECT * FROM ".$db_prefix."potd WHERE potd_type='P'");
$prows = dbrows($presult);
if ($prows != 0) {
$presult = dbquery("SELECT * FROM ".$db_prefix."potd WHERE potd_type='P'");
while ($pdata = dbarray($presult)) {
$lastchange = $pdata['potd_datestamp'];
$today = mktime(date("G"), date("i"), date("s"), date("m"), date("d"), date("Y"));
$timediff = ($today - $lastchange)/3600;
if ($timediff > 24) {
$result=dbquery(
"SELECT ta.album_id,album_title,photo_id,photo_title,photo_thumb1 FROM ".$db_prefix."photo_albums ta ".
"JOIN ".$db_prefix."photos USING (album_id) WHERE photo_id!='".$pdata['potd_tid']."' ORDER BY RAND() LIMIT 1"
);
if(dbrows($result)==1){
$data=dbarray($result);
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
$filename=PHOTODIR.$data['photo_thumb1'];
if(!file_exists($filename)) $filename=$image_url.'/imagenotfound.jpg';
echo "<center>
<a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".$filename."'
title='".$data['photo_title']."' alt='".$data['photo_title']."'>
</a><br />
<a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."'>".$data['album_title']."
</center></a>";
}
$timenow = mktime(24-$settings['timeoffset'], 0, 0, date("m"), date("d"), date("Y"));
$result = dbquery("UPDATE ".$db_prefix."potd SET potd_tid='".$data['photo_id']."', potd_datestamp='".$timenow."' WHERE potd_id='".$pdata['potd_id']."'");
} else {
$result=dbquery(
"SELECT ta.album_id,album_title,photo_id,photo_title,photo_thumb1 FROM ".$db_prefix."photo_albums ta ".
"JOIN ".$db_prefix."photos USING (album_id) WHERE photo_id='".$pdata['potd_tid']."'"
);
$data=dbarray($result);
define("PHOTODIR", PHOTOS.(!SAFEMODE ? "album_".$data['album_id']."/" : ""));
$filename=PHOTODIR.$data['photo_thumb1'];
if(!file_exists($filename)) $filename=$image_url.'/imagenotfound.jpg';
echo "<center><a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".$filename."'
title='".$data['photo_title']."' alt='".$data['photo_title']."'>
</a><br />
<a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."'>".$data['album_title']."
</center></a>";
}
}
} else {
$result=dbquery(
"SELECT ta.album_id,album_title,photo_id,photo_title,photo_thumb1 FROM ".$db_prefix."photo_albums ta ".
"JOIN ".$db_prefix."photos USING (album_id) ORDER BY RAND() LIMIT 1"
);
if(dbrows($result)==1){
$data=dbarray($result);
$filename=PHOTOS.$data['photo_id'].'t.jpg';
if(!file_exists($filename)) $filename=$image_url.'/imagenotfound.jpg';
echo "
<a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".PHOTOS."album_".$data['album_id']."/".$data['photo_thumb1']."'
title='".$data['photo_title']."' alt='".$data['photo_title']."'>
</a><br />
<a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."'>".$data['album_title']."
</a>";
}
$timenow = mktime(24-$settings['timeoffset'], 0, 0, date("m"), date("d"), date("Y"));
$result = dbquery("INSERT INTO ".$db_prefix."potd (potd_id, potd_type, potd_tid, potd_datestamp) VALUES('', 'P', '".$data['photo_id']."', '".$timenow."')");
}
echo "<td>";
$result = dbquery("SELECT * FROM ".$db_prefix."photos ORDER BY photo_id DESC LIMIT 0,3");
if (dbrows($result) != 0) {
while($data = dbarray($result)) {
if ($counter != 0 && ($counter % 4 == 0)) echo "</tr>\n";
echo "<td align='left' valign='top' class='tbl' style='white-space:nowrap'>\n";
$itemsubject = trimlink($data['photo_id'], 23);
$itemdescription = trimlink($data['photo_title'], 23);
echo " <a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".PHOTOS."album_".$data['album_id']."/".$data['photo_thumb1']."' width='100' height='75' title='".$data['photo_title']."' alt='".$data['photo_title']."'></a>
</a>\n";
echo "<span class='small'>";
$counter++;
}
}
echo "</tr>";
echo "</td>";
echo "<tr>";
echo "<td>";
$result = dbquery("SELECT * FROM ".$db_prefix."photos ORDER BY photo_id DESC LIMIT 0,3");
if (dbrows($result) != 0) {
while($data = dbarray($result)) {
if ($counter != 0 && ($counter % 4 == 0)) echo "</tr>\n";
echo "<td align='left' valign='top' class='tbl' style='white-space:nowrap'>\n";
$itemsubject = trimlink($data['photo_id'], 23);
$itemdescription = trimlink($data['photo_title'], 23);
echo " <a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' class='gallery'>
<img src='".PHOTOS."album_".$data['album_id']."/".$data['photo_thumb1']."' width='100' height='75' title='".$data['photo_title']."' alt='".$data['photo_title']."'></a>
</a>\n";
echo "<span class='small'>";
$counter++;
}
}
echo "</table></tr></td>";
closetable();
?> Kliknij i zaczekaj na załadowanie kodu ...
prosiłbym o zerknięcie na niego co tam namieszałem i ewentualnie co z tym zrobić dalej, u mnie to wygląda tak
dzięki
pozdrawiam.
PW od moderatora:
- Brak Stopki! - Pieka 18.01 - 15:22
|