4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: fah on February 13, 2008, 10:03:51 AM

Title: More random images on detail page
Post by: fah on February 13, 2008, 10:03:51 AM
Hello,
defaultly there is only 1 random image, but I would like to do 4 random images. Please help!
Title: Re: More random images on detail page
Post by: nobby on February 13, 2008, 08:40:16 PM
Here please Review  :arrow: http://www.4homepages.de/forum/index.php?board=15.0
Title: Re: More random images on detail page
Post by: fah on February 13, 2008, 08:43:31 PM
But I would like random images withou slideshow.
Title: Re: More random images on detail page
Post by: nobby on February 13, 2008, 08:47:10 PM
But I would like random images withou slideshow.

In this category afternoon
Title: Re: More random images on detail page
Post by: thunderstrike on February 14, 2008, 04:39:25 AM
Try this:

http://www.4homepages.de/forum/index.php?topic=4259.msg17513#msg17513
Title: Re: More random images on detail page
Post by: fah on February 14, 2008, 09:20:15 AM
Try this:

http://www.4homepages.de/forum/index.php?topic=4259.msg17513#msg17513
This works, but only on home page And I need random images on Detail page. :(
Title: Re: More random images on detail page
Post by: mawenzi on February 14, 2008, 09:34:19 AM
... than add V@no's code in details.php ...
... and use {random_images} in details.html ...
... ;) ...
Title: Re: More random images on detail page
Post by: fah on February 15, 2008, 11:15:34 AM
... than add V@no's code in details.php ...
... and use {random_images} in details.html ...
... ;) ...
Not works :( (SQL errors).
Title: Re: More random images on detail page
Post by: mawenzi on February 15, 2008, 01:31:30 PM
... do you read the error message ...  :?:
... so ... replace ...
Code: [Select]
LIMIT $num_new_images";
... by ... e.g. ...
Code: [Select]
LIMIT 4";
... and now it works perfectly ...  :!:
Title: Re: More random images on detail page
Post by: fah on February 15, 2008, 01:55:33 PM
... do you read the error message ...  :?:
... so ... replace ...
Code: [Select]
LIMIT $num_new_images";
... by ... e.g. ...
Code: [Select]
LIMIT 4";
... and now it works perfectly ...  :!:

Now it works, but I heve very interesting problem. When I click on any image with random images, it opens DIFFERENT image (eg. when I clicks thumbnail of image Nr 1, it opens image NR 5)!
Title: Re: More random images on detail page
Post by: mawenzi on February 15, 2008, 02:09:19 PM
... you must insert the "random code" from V@no on the top in details.php ...
... directly after ...
Code: [Select]
$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", i.".$key;
  }
}
Title: Re: More random images on detail page
Post by: fah on February 15, 2008, 02:37:45 PM
Now it works well! Thank you very much!
Title: Re: More random images on detail page
Post by: FunnyUser on March 09, 2008, 12:17:48 PM
Hey there!
How can I add this code:
Code: [Select]
AND a.cat_id IN (2,6)
in this section of "random_image":
Code: [Select]
$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 10";

It doesn't if I replace "AND c.cat_id = i.cat_id"
I get an error after I did that.

So I want just show some random images from certain categories on my details.php

Thanks for your help!
Title: Re: More random images on detail page
Post by: FunnyUser on March 20, 2008, 11:03:58 PM
anybody?? :)
Title: Re: More random images on detail page
Post by: bergblume on February 23, 2009, 05:28:52 PM
Hey there!
How can I add this code:
Code: [Select]
AND a.cat_id IN (2,6)
in this section of "random_image":
Code: [Select]
$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 10";

It doesn't if I replace "AND c.cat_id = i.cat_id"
I get an error after I did that.

So I want just show some random images from certain categories on my details.php

Thanks for your help!


is there already a solution available for above requested question? I would like to know how to realize this....