Author Topic: More random images on detail page  (Read 13835 times)

0 Members and 1 Guest are viewing this topic.

Offline fah

  • Newbie
  • *
  • Posts: 20
    • View Profile
More random images on detail page
« 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!

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.873
    • View Profile
Re: More random images on detail page
« Reply #1 on: February 13, 2008, 08:40:16 PM »

Offline fah

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: More random images on detail page
« Reply #2 on: February 13, 2008, 08:43:31 PM »
But I would like random images withou slideshow.

Offline nobby

  • 4images Guru
  • *******
  • Posts: 2.873
    • View Profile
Re: More random images on detail page
« Reply #3 on: February 13, 2008, 08:47:10 PM »
But I would like random images withou slideshow.

In this category afternoon

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline fah

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: More random images on detail page
« Reply #5 on: February 14, 2008, 09:20:15 AM »

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: More random images on detail page
« Reply #6 on: February 14, 2008, 09:34:19 AM »
... than add V@no's code in details.php ...
... and use {random_images} in details.html ...
... ;) ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline fah

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: More random images on detail page
« Reply #7 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).

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: More random images on detail page
« Reply #8 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 ...  :!:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline fah

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: More random images on detail page
« Reply #9 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)!

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: More random images on detail page
« Reply #10 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;
  }
}
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline fah

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: More random images on detail page
« Reply #11 on: February 15, 2008, 02:37:45 PM »
Now it works well! Thank you very much!

Offline FunnyUser

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: More random images on detail page
« Reply #12 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!

Offline FunnyUser

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Re: More random images on detail page
« Reply #13 on: March 20, 2008, 11:03:58 PM »
anybody?? :)

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: More random images on detail page
« Reply #14 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....