4images Modifications / Modifikationen > Mods & Plugins (Requests & Discussions)
Random pictures
nikolas22t:
Is there any way to change it to have 2 rows of 4 pictures and
of course the 3 new pictures?
or put two variables for rows to cells in order to add as many you want?
Lunique:
I have to more questions:
Is it possible to get the same for the categories?
Is it possible that only the pictures are shown and not "image name", "new", "user name" or else?
would be sooo great if you could help me!
hugs Luna
donpedro:
Hi,
can anyone tell me if it works in 4images 1.6 too ?
regards
dp
Michael:
Hallo,
kann man die Zufallsbilder nach Hits oder Votes anzeigen lassen?
Michael:
Nun hab ich zu mindestens herausgefunden wie man mehrere Zellen einbindet.
suche in includes/page_header.php nach
--- Code: ---$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
unset($random_image);
--- End code ---
ersetzte es dann gegen:
--- Code: ---$random_image = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$random_image2 = (defined("SHOW_RANDOM_IMAGE") && SHOW_RANDOM_IMAGE == 0) ? "" : get_random_image();
$site_template->register_vars("random_image", $random_image);
$site_template->register_vars("random_image2", $random_image2);
unset($random_image);
unset($random_image2);
--- End code ---
füge dann folgendes unter Venos Random Images in der Index.php hinzu:
--- Code: ---//------------------------------------
//------- Random Images_2 --------------
//------------------------------------
$num_new_images = $config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
ORDER BY RAND()
LIMIT $num_new_images";
// end new
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$random_images_2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
// $random_images_2 .= $lang['no_new_images'];
$random_images_2 .= "</td></tr></table>";
}
else {
$random_images_2 = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$random_images_2 .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$random_images_2 .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$random_images_2 .= $site_template->parse_template("thumbnail_bit");
$random_images_2 .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$random_images_2 .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$random_images_2 .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$random_images_2 .= "</tr>\n";
}
}
$random_images_2 .= "</table>\n";
} // end else
$site_template->register_vars("random_images_2", $random_images_2);
unset($random_images_2);
//----- End Random Images_2---------
--- End code ---
in der home.html {random_images_2} entsprechend einbinden
Das ganze kann man beliebig verlängern :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version