Quote
FlancitoW wrote:
I need a panel to show random photos for only one category. How i can do that?
// Set Album ID
$album_id = "1";
$result = dbquery("SELECT photo_id, album_id, photo_title, photo_thumb1 FROM ".DB_PHOTOS." WHERE album_id = '".$album_id."' ORDER BY RAND() LIMIT 1");
if (dbrows($result) != 0) {
openside("Random Photo");
echo "<div align='center'>";
while($data = dbarray($result)) {
$data_album = dbarray(dbquery("SELECT album_id, album_title FROM ".DB_PHOTO_ALBUMS." where album_id = ".$data['album_id'].""));
$itemsubject = trimlink($data['photo_id'], 23);
$itemdescription = trimlink($data['photo_title'], 30);
$albumname = trimlink($data_album['album_title'], 30);
echo "<center>".$new."<a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' title='".$data['photo_title']."' class='side'>";
echo "<img src='".BASEDIR."images/photoalbum/"."album_".$data['album_id']."/".$data['photo_thumb1']."' border='0' alt='' /><br />".$itemdescription."</a><br />";
echo "<span class='small'><a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."' title='".$data_album['album_title']."' class='side'>".$albumname."</a></span></center>";
}
echo "</div>";
closeside();
}
WHERE album_id IN (".$album_id.")
AND news_cat_id='$cat_id1'
AND news_cat_id IN (".$cat_id1.")
$result = dbquery("SELECT photo_id, album_id, photo_title, photo_thumb1 FROM ".DB_PHOTOS." WHERE album_id = '".$album_id."' ORDER BY RAND() LIMIT 4");
if (dbrows($result) != 0) {
openside("Random Photo");
echo "<div align='center'>";
while($data = dbarray($result)) {
$data_album = dbarray(dbquery("SELECT album_id, album_title FROM ".DB_PHOTO_ALBUMS." where album_id = ".$data['album_id'].""));
$itemsubject = trimlink($data['photo_id'], 23);
$itemdescription = trimlink($data['photo_title'], 30);
$albumname = trimlink($data_album['album_title'], 30);
echo "<center>".$new."<a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' title='".$data['photo_title']."' class='side'>";
echo "<img src='".BASEDIR."images/photoalbum/"."album_".$data['album_id']."/".$data['photo_thumb1']."' border='0' alt='' /><br />".$itemdescription."</a><br />";
echo "<span class='small'><a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."' title='".$data_album['album_title']."' class='side'>".$albumname."</a></span></center>";
}
echo "</div>";
closeside();
}
AND news_cat_id NOT IN (".$cat_id1.")
Quote
HobbyMan wrote:
Create a new panel and add this into panel content...Code Download source
// Set Album ID
$album_id = "1";
$result = dbquery("SELECT photo_id, album_id, photo_title, photo_thumb1 FROM ".DB_PHOTOS." WHERE album_id = '".$album_id."' ORDER BY RAND() LIMIT 1");
if (dbrows($result) != 0) {
openside("Random Photo");
echo "<div align='center'>";
while($data = dbarray($result)) {
$data_album = dbarray(dbquery("SELECT album_id, album_title FROM ".DB_PHOTO_ALBUMS." where album_id = ".$data['album_id'].""));
$itemsubject = trimlink($data['photo_id'], 23);
$itemdescription = trimlink($data['photo_title'], 30);
$albumname = trimlink($data_album['album_title'], 30);
echo "<center>".$new."<a href='".BASEDIR."photogallery.php?photo_id=".$data['photo_id']."' title='".$data['photo_title']."' class='side'>";
echo "<img src='".BASEDIR."images/photoalbum/"."album_".$data['album_id']."/".$data['photo_thumb1']."' border='0' alt='' /><br />".$itemdescription."</a><br />";
echo "<span class='small'><a href='".BASEDIR."photogallery.php?album_id=".$data['album_id']."' title='".$data_album['album_title']."' class='side'>".$albumname."</a></span></center>";
}
echo "</div>";
closeside();
}
Set album id to suit
Category Forum
Modifications and Requests - 8Labels
None yet
Statistics
6 participants
Notifications
You are not receiving notifications from this thread.
Related Questions