• [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 182122 times)

0 Members and 2 Guests are viewing this topic.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #105 on: October 28, 2009, 02:10:04 PM »
... is deactivating of cache in global.php a solution for you ... ?
Code: [Select]
$cache_enable          = 0;
... or only ...
Code: [Select]
$cache_page_categories = 0;
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 Joss

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • All about digital photography
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #106 on: October 28, 2009, 02:20:42 PM »
mawenzi,
thank you but it is temporary solution for me that I use now. At this time I've $cache_page_categories = 0; but I want to turn on it and use his MOD. :)

And also, can you say something to
http://www.4homepages.de/forum/index.php?topic=26162.0 ?
Digital Photo Gallery: http://gallery.imagemaster.ru

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #107 on: October 28, 2009, 02:28:56 PM »
in categories.php find:
    $config['template_dir'],


insert below:
    $config['image_sort'],
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Joss

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
    • All about digital photography
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #108 on: October 28, 2009, 03:08:03 PM »
V@no,
thanks but it is not working. Does it affect both version (A and B), I've use B?
« Last Edit: October 28, 2009, 03:38:29 PM by Joss »
Digital Photo Gallery: http://gallery.imagemaster.ru

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #109 on: January 10, 2010, 07:26:28 PM »
Hello together,

I use this great MOD already for a while.

I now want to know if it possible to have in a certain category (own template categories_10.htm) a fixed sorting that is pre-defined (latest added pic) by me and cannot be changed by users. In the other categories the users shall further have to possibility to sort of their own.

It would be great if I could define this in my categories_10.htm such a definition to have there always a sorting by latest added pics.

Looking forward to your solutions!

Bergblume

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #110 on: January 11, 2010, 05:21:30 AM »
@Joss:
yes, it affects any versions that uses cache.


@bergblume:
Try this. in includes/page_headers.php find:
//----End Images Sort----------------------------------

insert below:
$cat_sort_force = array(
  
10 => array("image_date""DESC"),
  
14 => array("image_name""ASC"),
  
31 => array("image_hits""DESC"),
);

if (isset(
$cat_sort_force[$cat_id]))
{
  
$config['image_order'] = $cat_sort_force[$cat_id][0];
  
$config['image_sort'] = $cat_sort_force[$cat_id][1];
}


In details.php find:
show_image($image_row$mode01);

insert below:
if (isset($cat_sort_force[$cat_id]))
{
  
$config['image_order'] = $cat_sort_force[$cat_id][0];
  
$config['image_sort'] = $cat_sort_force[$cat_id][1];
}


as an example the category with ID 10 will sort images by date, ID 14 by name and ID 31 by hits
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline bergblume

  • Sr. Member
  • ****
  • Posts: 463
  • on to the top!
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #111 on: January 11, 2010, 09:28:32 AM »
good morning v@no!

that´s great! it works perfect!

thank you!

bergblume!

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #112 on: January 12, 2010, 03:26:05 AM »
@v@no

... the code snippet for bergblume is a nice and usefull extension ... thanks for sharing ...
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 MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #113 on: May 19, 2010, 10:28:32 PM »
V@no, and how to do same thing for search_new_images=1?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #114 on: May 20, 2010, 02:04:30 AM »
V@no, and how to do same thing for search_new_images=1?
Same thing as what exactly? force specific sorting at new images page?
If yes, then in search.php and details.php find:
  if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {

Insert below:
    $config['image_order'] = "image_date";
    
$config['image_sort'] = "DESC";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #115 on: May 20, 2010, 11:00:19 AM »
V@no thank you very very much!!! This is what i need!!!  :D

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #116 on: August 22, 2010, 09:00:10 PM »
I've been looking in this mod and don't think its possible, but I'll ask:

is it possible to show images with most hits from last month (ORDER BY images_hits DESC && WHERE image_date > ".$last month.")

I know that i can get last month date by:
Code: [Select]
$last_month = time() - 60 * 60 * 24 * 7 * 30;

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #117 on: October 04, 2010, 07:45:05 PM »
I've been looking in this mod and don't think its possible, but I'll ask:

is it possible to show images with most hits from last month (ORDER BY images_hits DESC && WHERE image_date > ".$last month.")

I know that i can get last month date by:
Code: [Select]
$last_month = time() - 60 * 60 * 24 * 7 * 30;

Hi,

this is sure possible but you have to build the right sql select, i cannot do this for you sorry.
But i would to say it's sure possible.


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline henary

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #118 on: December 08, 2010, 09:10:30 PM »
Hello,

i've add this MOD into my 1.7.9, it works fine!

I'm also use the MOD "Create Sort Order for each category from Admin Panel" http://www.4homepages.de/forum/index.php?topic=5026.0 and there two things different:

Use:
Code: [Select]
$cat_cache[$cat_id]['sort_field']instead of
Code: [Select]
$config['image_order']and
Code: [Select]
$cat_cache[$cat_id]['sort_order']instead of
Code: [Select]
$config['image_sort']
You have to replace two/three times each after you use the code from #2 http://www.4homepages.de/forum/index.php?topic=3842.0;msg=15861

Thank you v@no for this MOD!

Regards,
Henry

EDIT:
I would like to make combination of sorting from ACP and this MOD more perfectly! I've i use session-based user-sort, it will start by default from ACP-setting for the categorie. If user change sorting, this works fine, until session is out of date, but the user-setting now is using by any other categorie. If using Cockie-based code, the ACP-Settings have no chance  :wink:

What about this: if user change sorting order from categorie, this will be only in this categorie. If user change categorie, the default from ACP will taken until user change. May it's possible to do that?

Regards,
Henry
« Last Edit: December 09, 2010, 05:05:46 PM by henary »

Offline henary

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: [Mod] Let visitors to chose how to sort images(date,name,..)
« Reply #119 on: December 14, 2010, 09:41:34 PM »
Hello, here again and i will post you something fine  :mrgreen:

i've found the solution to combining this MOD Let visitors to chose how to sort images(date,name,..) (Sessionmode) and MOD Create Sort Order for each category from Admin Panel (http://www.4homepages.de/forum/index.php?topic=5026.0).

Now, you set up each sortorder in ACP for each category and if the user like to change, this will only used in current category - if user go into different categorie, sortorder will be by default from acp for this new categorie. And if user go back to last categorie with changed sortorder, it will be by default again - not the last state.
If go to index-page (or any other no cat page like search, lightbox ...) and back to last category, the sortorder will be at last changend state, not default from ACP.

If using highslide it will do same fine  :wink:

Please change the code from 1.3. from http://www.4homepages.de/forum/index.php?topic=3842.msg15861#msg15861

For using with MOD Create Sort Order for each category from Admin Panel
//-----------------------------------------------------
//--- Set Images Sort ---------------------------------
//-----------------------------------------------------

if ($cat_id != 
 {
   
$catimagesorder $site_sess->get_session_var('catimages_order');
   if (
	
$catimagesorder <> $cat_id ) {
	
$site_sess->set_session_var('catimages_order'$cat_id);
	
if (isset(
$HTTP_POST_VARS['imagesorder'])) {
	
  
$imagesorder $cat_cache[$cat_id]['sort_field'];
	
  if (
$imagesorder) {
	
    
$site_sess->set_session_var("imgs_order"$imagesorder);
	
    
$session_info['imgs_order'] = $imagesorder;
	
  }
	
}
	
if (isset(
$HTTP_POST_VARS['imagessort'])) {
	
 
$imagessort $cat_cache[$cat_id]['sort_order']; 
	
  if (
$imagessort) {
	
    
$site_sess->set_session_var("imgs_sort"$imagessort);
	
    
$session_info['imgs_sort'] = $imagessort;
	
  }
	
}
	
}
	
else
	
{
	
if (isset(
$HTTP_POST_VARS['imagesorder'])) {
	
  
$imagesorder $HTTP_POST_VARS['imagesorder'];
	
  if (
$imagesorder) {
	
    
$site_sess->set_session_var("imgs_order"$imagesorder);
	
    
$session_info['imgs_order'] = $imagesorder;
	
  }
	
}

	
if (isset(
$session_info['imgs_order'])) {
	
  
$cat_cache[$cat_id]['sort_field'] = $session_info['imgs_order'];
	
}

	
if (isset(
$HTTP_POST_VARS['imagessort'])) {
	
 
$imagessort $HTTP_POST_VARS['imagessort']; 
	
  if (
$imagessort) {
	
    
$site_sess->set_session_var("imgs_sort"$imagessort);
	
    
$session_info['imgs_sort'] = $imagessort;
	
  }
	
}

	
if (isset(
$session_info['imgs_sort'])) {
	
  
$cat_cache[$cat_id]['sort_order'] = $session_info['imgs_sort'];
	
}
   }
}
//----End Images Sort----------------------------------


I've not tested, what will do, if you not have installed MOD Create Sort Order for each category from Admin Panel - may it works in same way but even with default sortorder by ACP for all categories.
For using without MOD Create Sort Order for each category from Admin Panel Try this code:
//-----------------------------------------------------
//--- Set Images Sort ---------------------------------
//-----------------------------------------------------

if ($cat_id != 
 {
   
$catimagesorder $site_sess->get_session_var('catimages_order');
   if (
	
$catimagesorder <> $cat_id ) {
	
$site_sess->set_session_var('catimages_order'$cat_id);
	
if (isset(
$HTTP_POST_VARS['imagesorder'])) {
	
  
$imagesorder $config['image_order'];
	
  if (
$imagesorder) {
	
    
$site_sess->set_session_var("imgs_order"$imagesorder);
	
    
$session_info['imgs_order'] = $imagesorder;
	
  }
	
}
	
if (isset(
$HTTP_POST_VARS['imagessort'])) {
	
 
$imagessort $config['image_sort']; 
	
  if (
$imagessort) {
	
    
$site_sess->set_session_var("imgs_sort"$imagessort);
	
    
$session_info['imgs_sort'] = $imagessort;
	
  }
	
}
	
}
	
else
	
{
	
if (isset(
$HTTP_POST_VARS['imagesorder'])) {
	
  
$imagesorder $HTTP_POST_VARS['imagesorder'];
	
  if (
$imagesorder) {
	
    
$site_sess->set_session_var("imgs_order"$imagesorder);
	
    
$session_info['imgs_order'] = $imagesorder;
	
  }
	
}

	
if (isset(
$session_info['imgs_order'])) {
	
  
$config['image_order'] = $session_info['imgs_order'];
	
}

	
if (isset(
$HTTP_POST_VARS['imagessort'])) {
	
 
$imagessort $HTTP_POST_VARS['imagessort']; 
	
  if (
$imagessort) {
	
    
$site_sess->set_session_var("imgs_sort"$imagessort);
	
    
$session_info['imgs_sort'] = $imagessort;
	
  }
	
}

	
if (isset(
$session_info['imgs_sort'])) {
	
  
$config['image_sort'] = $session_info['imgs_sort'];
	
}
   }
}
//----End Images Sort----------------------------------


Please write your feedback here.

Regards,
Henry

v@no: feel free to edit or move this  :wink:
« Last Edit: December 19, 2010, 11:03:39 AM by henary »