Author Topic: New Images - Random Possible?  (Read 8298 times)

0 Members and 1 Guest are viewing this topic.

Offline Schmidti

  • Newbie
  • *
  • Posts: 32
    • View Profile
New Images - Random Possible?
« on: May 18, 2007, 07:16:36 PM »
Hi... auf der Startseite von 4images werden immer die drei zuletzt hinzugefügten Bilder angezeigt. Ist es möglich hier immer zufälllige "neue" Bilder anzuzeigen? Wenn ich nun 100 neue Bilder freischalte, sollen diese per Zufall angezeigt werden.

Hi... at the start page of 4images you see always the three newest pictures. Is it possible to show randomized "new" images? If i add 100 new pictures, than three of them should be on the startpage...

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: New Images - Random Possible?
« Reply #1 on: May 18, 2007, 08:08:44 PM »
hallo,

öffne index.php

suche:
Code: [Select]
ORDER BY i.image_date DESC
ersetze mit:
Code: [Select]
ORDER BY RAND()  :wink:


Gruß
Kurt

Offline Schmidti

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: New Images - Random Possible?
« Reply #2 on: May 18, 2007, 08:13:07 PM »
hallo,

öffne index.php

suche:
Code: [Select]
ORDER BY i.image_date DESC
ersetze mit:
Code: [Select]
ORDER BY RAND()  :wink:


Gruß
Kurt

Naja, aber ich will das nur "neue" Bilder als Random angezeigt werden

Well, but i want that only "new" pictures are shown randomimzed

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: New Images - Random Possible?
« Reply #3 on: May 18, 2007, 08:50:15 PM »
Hallo,

hier nochmals die kompletten Änderungen für new images mit random:

in index.php

suche:
Code: [Select]
$num_new_images = $config['image_cells'];füge davor ein:
Code: [Select]
$new_images_random = time() - 60 * 60 * 24 * $config['new_cutoff'];

suche:
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN")."ersetze mit:
Code: [Select]
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") AND i.image_date >= $new_images_random

suche:
Code: [Select]
ORDER BY i.image_date DESCersetze mit:
Code: [Select]
ORDER BY RAND()


:wink:
Gruß
Kurt
« Last Edit: May 18, 2007, 09:13:02 PM by KurtW »

Offline Schmidti

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: New Images - Random Possible?
« Reply #4 on: May 18, 2007, 09:12:10 PM »
Danke funktioniert!

Dennoch ein kleiner Zusatz: Sollten keine neuen Bilder verfügbar sein, soll er einfach Zufallsbilder aus allen Bildern nehmen.

Was müsste ich dafür noch ändern?


Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: New Images - Random Possible?
« Reply #5 on: July 05, 2007, 06:19:33 AM »
$config['new_cutoff'];

do we have to insert a value here? If so What value, what number? Sorry I dont understand. the number is for time? number of pics ?
« Last Edit: July 05, 2007, 06:33:33 AM by AntiNSA2 »
As long as I can finish my site before I die.

Offline AntiNSA2

  • Hero Member
  • *****
  • Posts: 774
  • As long as I can finish my site before I die.
    • View Profile
    • http://www.thelifephotography.com
Re: New Images - Random Possible?
« Reply #6 on: July 05, 2007, 06:36:20 AM »
I recieve this error on v 1.74

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/cyberfan/htdocs/4images/includes/db_mysql.php on line 116

I think this is a useful mod
As long as I can finish my site before I die.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
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 bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: New Images - Random Possible?
« Reply #8 on: February 28, 2010, 11:43:07 AM »
danke für diese sehr gute modifikation!!
bringt dynamik in die seite (auch wenn man seit längerem kein update gemacht hat) !!
TOP!