• [Mod] Let visitors to chose how to sort images(date,name,..) 5 0 5 1
Currently:  

Author Topic: [Mod] Let visitors to chose how to sort images(date,name,..)  (Read 182080 times)

0 Members and 1 Guest are viewing this topic.

Offline darvid

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • KNOWTEBOOK.COM - Community for webdeveloper
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #75 on: April 30, 2006, 10:08:15 AM »
I found out myself, now. It might be a MOD.

Go in categories.php to line 113 an replace:

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 i.cat_id = $cat_id AND c.cat_id = i.cat_id
        ORDER BY ".$config['image_order']." ".$config['image_sort']."
        LIMIT $offset, $perpage";

with

Code: [Select]
$new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
$num_new_images = $config['image_cells'];
$sql = "SELECT IF(i.image_date >= $new_cutoff,RAND()+1,1) as random_no, 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 NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
        ORDER BY random_no DESC, RAND(), i.image_date DESC
        LIMIT $offset, $perpage";

Thats it!
/* KNOWTEBOOK - BoostYourself community for webdeveloper
/* http://www.knowtebook.com

Integration von Wordpress Blog, PHPBB Forum und 4Images Bildergalerie:
http://www.sebastianscheuer.de/aktuell/integration-von-wordpress-blog-phpbb-forum-und-4images-bildergallerie/
DEMO: http://www.pilotenbilder.de/

Offline True4

  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #76 on: June 05, 2006, 12:27:47 AM »
ich bekomme leider die fehlermeldung
Warning: Invalid argument supplied for foreach() in includes/page_header.php on line 462

Warning: Invalid argument supplied for foreach() in includes/page_header.php on line 470

woran kann es liegen?

danke
true4

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #77 on: September 30, 2006, 12:45:18 AM »
Here is what i am trying to do.
I m not using Categories drop down so i want to have one "Go" button and what to control
"Sort Order" along with no. of pictures per page.
Here is what i have right now, but its not working at all. (Sort order doesn’t change just no. of images per page changes)
setperpage_dropdown_form
Code: [Select]
<form method="post" action="{self}">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>{lang_images_per_page}&nbsp;</td>
      <td>{setperpage_dropdown}&nbsp;</td>
   <td>{imgsort_dropdown_form}&nbsp;&nbsp;&nbsp;
        <input type="submit" value="{lang_go}" class="button" name="submit" />
      </td>
    </tr>
  </table>
</form>

Imgsort_dropdown_form
Code: [Select]
<FORM method="post" action="{self}">
 <table border="0" cellspacing="0" cellpadding="0">
    <tr>
<TD nowrap>{image_order}&nbsp;:&nbsp;</TD>
<TD nowrap>{imgsort_dropdown}&nbsp;&nbsp;</TD>
    </tr>
 </table>
</FORM>

I m not a  Programmer.
          But
I m a Good Learner.

Offline Fastian

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #78 on: October 12, 2006, 09:45:04 AM »
Here is what i am trying to do.
I m not using Categories drop down so i want to have one "Go" button and what to control
"Sort Order" along with no. of pictures per page.
Here is what i have right now, but its not working at all. (Sort order doesn’t change just no. of images per page changes)
setperpage_dropdown_form
Code: [Select]
<form method="post" action="{self}">
  <table border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td>{lang_images_per_page}&nbsp;</td>
      <td>{setperpage_dropdown}&nbsp;</td>
   <td>{imgsort_dropdown_form}&nbsp;&nbsp;&nbsp;
        <input type="submit" value="{lang_go}" class="button" name="submit" />
      </td>
    </tr>
  </table>
</form>

Imgsort_dropdown_form
Code: [Select]
<FORM method="post" action="{self}">
 <table border="0" cellspacing="0" cellpadding="0">
    <tr>
<TD nowrap>{image_order}&nbsp;:&nbsp;</TD>
<TD nowrap>{imgsort_dropdown}&nbsp;&nbsp;</TD>
    </tr>
 </table>
</FORM>


No One ??  :(
I m not a  Programmer.
          But
I m a Good Learner.

Offline GhostPool

  • Newbie
  • *
  • Posts: 42
    • View Profile
    • GhostPool Designs
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #79 on: October 22, 2006, 11:12:05 PM »
Is there a way to change the drop down menu to text links. For example, I would like to be able to click Name, Date, Rating etc. to sort the images. An example of this is posted here, http://www.desktopwallpapers.co.uk/desktop_wallpaper/landscapes.html

Hope someone can help! :D

Offline Romson

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #80 on: February 15, 2007, 03:22:22 PM »
Hi,

i add this mod but how can i make this mod to work for new images on my index page ?

http://www.lach.tv/fun/

Offline gborislav

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #81 on: July 13, 2007, 03:16:03 AM »
Hi,

I want to add this MOD to sub_categories , so in what file to add {imgsort_dropdown_form}

thanks.

Offline [M]ike

  • Newbie
  • *
  • Posts: 15
  • That guy who usually needs help...
    • View Profile
    • Messenger Display Pictures
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #82 on: July 23, 2007, 08:27:01 PM »
Great Mod, used it and is working perfectly. :)
http://messengerdp.com/categories.php?cat_id=9

Offline Falldog

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #83 on: August 05, 2007, 02:02:22 AM »
I'm running the code on the first page w/o any issue. I'd like to be able to sort by image_file_size though and am unsure how to edit the session code so it can do that.

Any help would be much appreciated!

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #84 on: August 05, 2007, 05:55:34 AM »
Do no need for session modify ... image size is no SQL but PHP from includes/functions.php file. ;)

Using GD - better result.
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 Falldog

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #85 on: October 07, 2007, 07:23:16 PM »
I haven't a clue what that means, sorry.  :(

/php idiot

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #86 on: October 07, 2007, 07:26:18 PM »
If for details page, use: {image_file_size} for see image filesize.
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 Falldog

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #87 on: October 07, 2007, 08:46:45 PM »
Well I try adding the following to my lang file in the image sort section,

Code: [Select]
"image_file_size" => "File Size"
When I chose the option on the main page I get the following SQL error...

Code: [Select]
An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /homepages/35/d90034645/htdocs/imgdump2/includes/db_mysql.php on line 116

...and images no longer show up on the page.

My uneducated guess is that it's somehow unable to sort based on the information that's stored within {image_file_size}?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #88 on: October 07, 2007, 09:11:20 PM »
Quote
Well I try adding the following to my lang file in the image sort section,

Which file you add the image_file_size for register ? I look ...
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 Falldog

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #89 on: October 08, 2007, 12:33:34 AM »
My /lang/english/main.php is here > http://www.fupushi.net/temp/main.txt

The "image_file_size" => "File Size" is down at the end.

And if you need it my

/includes/page_header.php > http://www.fupushi.net/temp/page_header.txt
/includes/sessions.php > http://www.fupushi.net/temp/sessions.txt
/includes/functions.php > http://www.fupushi.net/temp/functions.txt