4images Modifications / Modifikationen > Mods & Plugins (Requests & Discussions)

Random pictures

<< < (5/31) > >>

donpedro:
Hi Michael,

sieht gut aus, was Du da so machst !

dp

Michael:
Danke  :D

Nun weiß ich aber immer noch nicht wie ich die Random Bilder aus bestimmten Kategorien auslesen lasse.
Hatte schon folgende Idee, leider funktioniert es nicht.
AND i.cat_id IN (xx, xx, xx)

GeXX:
Maybe this will help:

Vielleicht hilft Dir das ja ein wenig weiter:

http://www.4homepages.de/forum/index.php?topic=9774.0

GeXX:
try this:


--- Code: ---$cat_in = array(2,7,8,11,12,15,16,18); //list of category ids // *** TO FILTER RANDOM IMAGES ***

$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").") AND i.cat_id IN (".implode(", ", $cat_in).")
       ORDER BY RAND()
       LIMIT $num_new_images";

--- End code ---

Michael:
Vielen Dank, das klappte auf Anhieb  :D

Schön wäre es wenn nun nur noch Bilder aus den erwählten Kategorien erscheinen würden die mindestens 9 Punkte haben,
also eine Selektierung nach Bewertungen.


 

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version