4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on January 29, 2003, 06:57:15 PM
-
Just a thought, would be nice let visitors to chose how they want browse pictures sorted by name/date.
-
ok, did it myself :roll:
This version uses sessions (that means, that after each time u open new browser window, it will reset settings to default).
If u want it uses cookies u'll need do some changes that I posted on 3rd page (http://www.4homepages.de/forum/index.php?topic=3842.msg20222#msg20222)
1. Open /includes/page_header.php
1.1. Find: "charset" => $lang['charset'],
1.2. Add after: "image_order" => $lang['image_order'],
"image_sort" => $lang['image_sort'],
1.3. At the end of the file, just before ?> add this code:
A - Sessions based (ones browser window is closed sorting options will be gone)
//-----------------------------------------------------
//--- Set Images Sort ---------------------------------
//-----------------------------------------------------
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 = intval($HTTP_POST_VARS['imagessort']);
$imagessort = $HTTP_POST_VARS['imagessort']; //Added 03-11-2003
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----------------------------------
//-----------------------------------------------------
//--- Set Images Sort Dropdown ------------------------
//-----------------------------------------------------
$imgsort_dropdown="\n<select name=\"imagesorder\" class=\"setperpageselect\">\n";
foreach ($image_order_optionlist as $key => $val) {
$imgsort_dropdown .= "<option value=\"$key\"";
if ($config['image_order'] == $key) {
$imgsort_dropdown .= " selected=\"selected\"";
}
$imgsort_dropdown .= ">".$val."</option>\n";
}
$imgsort_dropdown .= "</select>\n";
foreach ($image_sort_optionlist as $key => $val) {
$imgsort_dropdown .= "<INPUT type=\"radio\" name=\"imagessort\" value=\"$key\"";
if ($config['image_sort'] == $key) {
$imgsort_dropdown .= " checked";
}
$imgsort_dropdown .= ">".$val."\n";
}
if ($cat_id != 0) {
$imgsort_dropdown .= "<input type=\"hidden\" name=\"cat_id\" value=\"".$cat_id."\" />\n";
}
if (isset($show_result) && $show_result == 1) {
$imgsort_dropdown .= "<input type=\"hidden\" name=\"show_result\" value=\"1\" />\n";
}
$site_template->register_vars("imgsort_dropdown", $imgsort_dropdown);
$imgsort_dropdown_form = $site_template->parse_template("imgsort_dropdown_form");
$site_template->register_vars("imgsort_dropdown_form", $imgsort_dropdown_form);
$site_template->un_register_vars("imgsort_dropdown");
unset($imgsort_dropdown);
unset($imgsort_dropdown_form);
//-----End Images Sort Dropdown------------------------
B - Cookies based (will "remmeber" sorting options even after browser window was closed)
//-----------------------------------------------------
//--- Set Images Sort ---------------------------------
//-----------------------------------------------------
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;
}
}
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_order = isset($HTTP_COOKIE_VARS[$cookie_name.'imgs_order']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'imgs_order'])) : $config['image_order'];
$config['image_order'] = (isset($session_info['imgs_order'])) ? $session_info['imgs_order'] : $cookie_order;
$cookie_expire = time() + 60 * 60 * 24 * 90;
setcookie($cookie_name.'imgs_order', serialize($config['image_order']), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
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;
}
}
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_sort = isset($HTTP_COOKIE_VARS[$cookie_name.'imgs_sort']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'imgs_sort'])) : $config['image_sort'];
$config['image_sort'] = (isset($session_info['imgs_sort'])) ? $session_info['imgs_sort'] : $cookie_sort;
$cookie_expire = time() + 60 * 60 * 24 * 90;
setcookie($cookie_name.'imgs_sort', serialize($config['image_sort']), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
//----End Images Sort----------------------------------
//-----------------------------------------------------
//--- Set Images Sort Dropdown ------------------------
//-----------------------------------------------------
$imgsort_dropdown="\n<select name=\"imagesorder\" class=\"setperpageselect\">\n";
foreach ($image_order_optionlist as $key => $val) {
$imgsort_dropdown .= "<option value=\"$key\"";
if ($config['image_order'] == $key) {
$imgsort_dropdown .= " selected=\"selected\"";
}
$imgsort_dropdown .= ">".$val."</option>\n";
}
$imgsort_dropdown .= "</select>\n";
foreach ($image_sort_optionlist as $key => $val) {
$imgsort_dropdown .= "<INPUT type=\"radio\" name=\"imagessort\" value=\"$key\"";
if ($config['image_sort'] == $key) {
$imgsort_dropdown .= " checked";
}
$imgsort_dropdown .= ">".$val."\n";
}
if ($cat_id != 0) {
$imgsort_dropdown .= "<input type=\"hidden\" name=\"cat_id\" value=\"".$cat_id."\" />\n";
}
if (isset($show_result) && $show_result == 1) {
$imgsort_dropdown .= "<input type=\"hidden\" name=\"show_result\" value=\"1\" />\n";
}
$site_template->register_vars("imgsort_dropdown", $imgsort_dropdown);
$imgsort_dropdown_form = $site_template->parse_template("imgsort_dropdown_form");
$site_template->register_vars("imgsort_dropdown_form", $imgsort_dropdown_form);
$site_template->un_register_vars("imgsort_dropdown");
unset($imgsort_dropdown);
unset($imgsort_dropdown_form);
//-----End Images Sort Dropdown------------------------
2. Open /lang/YOURLANGUAGE/main.php
2.1. Add at the end of the file, just before ?> this code:
//--------------Images Sort-------------------------
//---This was taken from /lang/YOURLANG/admin.php---
//--------------------------------------------------
$lang['image_order'] = "Sort images by";
$image_order_optionlist = array(
"image_name" => "Name",
"image_date" => "Date",
"image_downloads" => "Downloads",
"image_votes" => "Votes",
"image_rating" => "Rating",
"image_hits" => "Hits"
);
$lang['image_sort'] = "Ascending/Descending";
$image_sort_optionlist = array(
"ASC" => "Ascending",
"DESC" => "Descending"
);
3. Create a template and save it as imgsort_dropdown_form.html with this code:<TABLE border="0" cellspacing="0" cellpadding="0">
<FORM method="post" action="{self}">
<TR>
<TD nowrap>{image_order} </TD>
<TD nowrap>
{imgsort_dropdown}
<INPUT type="submit" value="{lang_go}" class="button" name="submit" /></TD>
</TR>
</FORM>
</TABLE>
Now u can insert in any templates {imgsort_dropdown_form} in the place u want show "sort images by" sellect.
U can see it in action (its on the bottom):
http://gallery.vano.org/c6
-
WOW man, it works very well .... thanks ;)
check it out @ http://faithfulangels.com and select a category!
-
Works very well! Thank you. Greeting Ingo.
http://www.digitalfotograf.com/bilderkiste/categories.php?cat_id=4
-
I was thinking of another sort (thing) that could be useful!
How about having an option in the edit category where you could decide the default sort that category is sorted as...
And also, an adition, sorting by image_id would also be nice... so you can have the orignal upload order...
And finally, sorting by filename, not just by image name.... (which can be changed)...
Don't these ideas make sense...???
Anyway.. I know I sure would like to see it implemented, and I am sure others would find it useful too!
Anyway, great work V@no...
Your name sure do pop up here alot! :D
-
It would be perfect if someone could ehance this already nice mod to store the sort criteria in the database against the user table. That way the last selected sort method could be used on return visits and it would persist across PCs. Either that or store the info in a cookie.
Thanks V@no
-
.
-
Simply put the tag {imgsort_dropdown_form} in every template where you want it to appear, like search.html, category.html, and so forth.
Just put this tag within the HTML code so it is visible where you like, above or below the thumbnails or maybe even between the category-dropdown-menu and the picture per page drop-down-menu.
-
It would be perfect if someone could ehance this already nice mod to store the sort criteria in the database against the user table. That way the last selected sort method could be used on return visits and it would persist across PCs. Either that or store the info in a cookie.
Thanks V@no
yes, I like this idea, but I'd like have your guys appinium, how this should work. I mean, right now my idea do it this way:
1. user can select from his control panel (profile edit) how he want sort images and how many images per page by default (whenever he closed browser and then come back).
and when he browse the site, he still has chose of image sorting, that works temporary, untill he close/open browser (just like right now, original code of this mod stay as it is and needs just little addon to it)
2. or do u want changing images sorting not from "edit user profile" will be saved directly in the database? (this case whole mod needs to be rewriten)
-
I would prefer solution #2, because i use the gallery integrated into a phpBB2 forum, where the users access the user-profil from the phpBB2 and not the one from 4images.
Besides i think it would be much easier for most users to just change it without going to the user profil, eventhough it would mean a lot more work to programm it that way.
But you asked for opinons and this it mine... :)
-
yes, thx. (couple more opinions and I'll start work on it ;) )
P.S. dont forget, that sort images options will still be available as it is now, it just wont be saved in the database.
-
i think it would be quite nice for users to have this as a profile option. it would also be useful to keep it in thumbnail pages display so that they don't have to go to their control panel each time they would want to change the order...
-
.
-
I would prefer option 2 too ...
-
Can it sort by username too? Sometimes people may want to see what a user has posted.... Kindly let me know what to add thank you :D
GREAT MOD !!
-
Can it sort by username too? Sometimes people may want to see what a user has posted.... Kindly let me know what to add thank you :D
GREAT MOD !!
doesnt make too much sence, because u always can do search by user...
-
But can it be done with a extra code? Cause I do not know what code to put in for sort by username
-
But can it be done with a extra code? Cause I do not know what code to put in for sort by username
8O it was simpliest change I've ever done... :?
in /lang/<yourlanguage>/main.php replace the line u inserted: "image_hits" => "Hits"
with this: "image_hits" => "Hits",
"image_comments" => "Comments",
"user_name" => "User"
-
hmm...I guess it wasnt so simple...this method works untill u click on image details...
if no one figure it out, then I'll try fix it in 18 hours
[EDITED]
couldnt resist... :?
in details.php u'll need do following changes:
1.
find:if ($mode == "lightbox") {
if (!empty($user_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
$sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND image_id IN ($image_id_sql) AND cat_id IN (".get_auth_cat_sql("auth_viewcat").")
ORDER BY ".$config['image_order']." ".$config['image_sort'];
$in_mode = 1;
}
}
replace with:if ($mode == "lightbox") {
if (!empty($user_info['lightbox_image_ids'])) {
$image_id_sql = str_replace(" ", ", ", trim($user_info['lightbox_image_ids']));
$sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file, i.user_id
FROM ".IMAGES_TABLE." i
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND i.image_id IN ($image_id_sql) AND i.cat_id IN (".get_auth_cat_sql("auth_viewcat").")
ORDER BY ".$config['image_order']." ".$config['image_sort'];
$in_mode = 1;
}
}
2.
Find: else {
$cat_id_sql = get_auth_cat_sql("auth_viewcat");
}
if (!empty($sql_where_query)) {
$sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
FROM ".IMAGES_TABLE."
WHERE image_active = 1
$sql_where_query
AND cat_id IN ($cat_id_sql)
ORDER BY ".$config['image_order']." ".$config['image_sort'];
$in_mode = 1;
}
}
if (!$in_mode || empty($sql)) {
$sql = "SELECT image_id, cat_id, image_name, image_media_file, image_thumb_file
FROM ".IMAGES_TABLE."
WHERE image_active = 1 AND cat_id = $cat_id
ORDER BY ".$config['image_order']." ".$config['image_sort'];
}
$result = $site_db->query($sql);
Replace with: else {
$cat_id_sql = get_auth_cat_sql("auth_viewcat");
}
if (!empty($sql_where_query)) {
$sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file, i.user_id
FROM ".IMAGES_TABLE." i
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1
$sql_where_query
AND i.cat_id IN ($cat_id_sql)
ORDER BY ".$config['image_order']." ".$config['image_sort'];
$in_mode = 1;
}
}
if (!$in_mode || empty($sql)) {
$sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_media_file, i.image_thumb_file, i.user_id
FROM ".IMAGES_TABLE." i
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
ORDER BY ".$config['image_order']." ".$config['image_sort'];
}
$result = $site_db->query($sql);
-
.
-
ops, sry, didnt check my post, and I had extra "feature" in my own main.php.... :oops:
just edited my post, check it again. I also added this "new feature" ;)
-
.
-
opsy...my typo.
it's in details.php
*seems I'm the trouble here... :? *
-
.
-
geeee what's wrong with me today? :?
sry, my bad again.
change "Hits," to this: "Hits",
I added comma in wront place...
-
.
-
I can't get the mod to work. I did everything like it said in the second post. I don't get anny errormessages, but when I change the options and click on go, it always shows the images by Date, Descending, like I set it up in the control panel. These options also stay selected when I click on GO.
Does anybody know why this is? It looks like it can't override the Date, Descending options wich I set up in the Control Panel.
-
ok, I just find out why this script didnt work for me, when I uncommented two lines:
find:// $imagesorder = intval($HTTP_POST_VARS['imagesorder']);
Replace with: $imagesorder = $HTTP_POST_VARS['imagesorder'];
and find:// $imagessort = intval($HTTP_POST_VARS['imagessort']);
Replace with: $imagessort = $HTTP_POST_VARS['imagessort'];
that how it suposed to be :oops:
P.S. I edited my original post, so, if u just installed this MOD, then dont worry about changes above.
-
YES!
It works now for me to. How strange. I had those 2 lines commented, but when I changed them into the new lines you gave, uncommented it worked! :D
-
YES!
It works now for me to. How strange. I had those 2 lines commented, but when I changed them into the new lines you gave, uncommented it worked! :D
yes, it took me just 3 month to figure it out... hehe
-
Programming is like that sometimes. :wink:
-
Hallo,
ich habe meine Galerie, wie im zweiten Beitrag beschrieben geändert. Nur kann ich keine Veränderung feststellen.
Meine Frage: Was muss ich denn jetzt noch machen?
Da ich die englische Sprache nicht beherrsche, kann ich mit den nachfolgenden Beiträgen in diesem Thread leider nichts anfangen. Kann mir denn jemand weiterhelfen?
Gruß Dirk
-
If u want use cookies do following changes:
In the original code in the step 1.3. replace:
//-----------------------------------------------------
//--- Set Images Sort ---------------------------------
//----original script is 'Setperpage'. but it doesnt work if uncoment those two lines below ):
//----Maybe someone knows why? (;---------
//-----------------------------------------------------
if (isset($HTTP_POST_VARS['imagesorder'])) {
// $imagesorder = intval($HTTP_POST_VARS['imagesorder']); //I dont understand why when this line uncoment, the script doesnt work?
$imagesorder = $HTTP_POST_VARS['imagesorder']; //Added 03-11-2003
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 = intval($HTTP_POST_VARS['imagessort']);
$imagessort = $HTTP_POST_VARS['imagessort']; //Added 03-11-2003
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----------------------------------
with this://-----------------------------------------------------
//--- Set Images Sort ---------------------------------
//-----------------------------------------------------
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;
}
}
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_order = isset($HTTP_COOKIE_VARS[$cookie_name.'imgs_order']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'imgs_order'])) : $config['image_order'];
$config['image_order'] = (isset($session_info['imgs_order'])) ? $session_info['imgs_order'] : $cookie_order;
$cookie_expire = time() + 60 * 60 * 24 * 90;
setcookie($cookie_name.'imgs_order', serialize($config['image_order']), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
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;
}
}
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_sort = isset($HTTP_COOKIE_VARS[$cookie_name.'imgs_sort']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'imgs_sort'])) : $config['image_sort'];
$config['image_sort'] = (isset($session_info['imgs_sort'])) ? $session_info['imgs_sort'] : $cookie_sort;
$cookie_expire = time() + 60 * 60 * 24 * 90;
setcookie($cookie_name.'imgs_sort', serialize($config['image_sort']), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
//----End Images Sort----------------------------------
-
hi, i seem to be having a little problem with this, not sure why. i followed the instructions and then i inserted this into category.html:
<tr>
<td width="80%">
<p align="right">{imgsort_dropdown_form}</td>
<td width="20%">
<p align="right">{upload_button}</td>
</tr>
but the drop down menu is not showing correctly, and i'm not sure why.
-
but the drop down menu is not showing correctly, and i'm not sure why.
Please be more specific, what doesnt work? not showing correctly? what does it show? also, if u could post a link or something, could be usefull too.
-
alright i'm not sure how to be more specific in words. you can see what is happening here http://www.net-x.org/img
go to a category and look next to the "upload" button at the top. that is where the code has been inserted but all i get is a wierd little button, thanks
-
ok, that was enough ;)
btw, I've never seen anything like that!
did u look at your page source code? it's pretty much....wierd...
not sure what do u use to edit .php files, or maybe it cause by something else, but the code showed with spaces between each letter! <td width="80%">
<p align="right">яю< T A B L E b o r d e r = " 0 " c e l l s p a c i n g = " 0 " c e l l p a d d i n g = " 0 " >
< F O R M m e t h o d = " p o s t " a c t i o n = " " >
< T R >
< T D n o w r a p > & n b s p ; < / T D >
< T D n o w r a p >
& n b s p ;
< I N P U T t y p e = " s u b m i t " v a l u e = " " c l a s s = " b u t t o n " n a m e = " s u b m i t " / > < / T D >
< / T R >
< / F O R M >
< / T A B L E > </td>
<td width="20%">
<p align="right"><img src="./templates/4dark/images/upload_off.gif" border="0" alt="" /></td>
so, hopefuly u did backup before u started do changes, restore what u did and try again...
-
wierd! something funky was going on...thanks for noticing that. all fixed now and working lovely!!
-
Hi V@no.
I trying to install this mod, but it giving me "404 Error - File Not Found" with the this address:
http://www.artpapa.com/gallery/lang/english/%7Bself%7D
sorry I cannot describe that better.
tx
Alexei
-
http://www.artpapa.com/gallery/lang/english/%7Bself%7D
seems to me u are using Macromedia Dreamweaver to edit files...
open again files u edited and replace all %7B and %7D with { and }
-
thank you
I find change only in the imgsort_dropdown_form.html, and make changes in the notepad as you provide in the mod instruction.
it is start work in the categories, but didn't work in the home template, I mean after reloading nothing is change. (Should it work in the home?).
what editor do you recommend?
-
it is start work in the categories, but didn't work in the home template, I mean after reloading nothing is change. (Should it work in the home?).
U must add exact same code in any templates where u want it be displayed.
what editor do you recommend?
Dreamweaver is very good editor, that "thing" doesnt happend all the time (atleast for me), it happend just ones in last 9 month I use it...
also, I have asked that question long time ago too ;):
http://www.4homepages.de/forum/viewtopic.php?t=1901
since then I use Ultraedit with absolutely no prblems, and I love it.
-
it is start work in the categories, but didn't work in the home template, I mean after reloading nothing is change. (Should it work in the home?).
U must add exact same code in any templates where u want it be displayed.
Thanks, I did {imgsort_dropdown_form}, bad pictures still in the same order.
-
what version of the MOD do u use? regular or with using cookies?
also, what do u mean "didnt work in the home template"? when u open index.php it shows u new images that being sorted by date, this MOD has no affect of "new images" part.
-
what version of the MOD do u use? regular or with using cookies?.
for some reason I change for cookies while trying to figure out, is their any difference?
this MOD has no affect of "new images" part.
I see, that mean not in the home.html template.
thanks a lot......
-
but I think it's sortted images by username will be better.
-
but I think it's sortted images by username will be better.
did u read all replys?
I posted the code on second page of this thread
http://www.4homepages.de/forum/viewtopic.php?t=3842
-
oh, sorry, it worked after I read the second page.
-
hi all,
is someone able to do this mod as a selfjump box as the ohter mods with dropdown lists? i have the category dropdown list and the images per page list as selfjump box, so this would be the only one where i have to click "go"...
i don´t know anything about php, so this is just a humble request :wink:
-
Be careful about making the submission of that a form a "selfjump" action. There are two form elements, the drop down list and the radio buttons. If I'm a user and I see that form, I'm going to think I can select something from the drop down "sort by" and then click one of the radio buttons to choose the ascending/descending. If you make the drop down list a selfjump, I'm going to be surprised that I couldn't change the radio button. This is a usability issue and just my two cents.
-
ok, that´s a good consideration.
-
just want to add to Chris post:
selfjump would work for dropdown, right? so, if u didnt select the order radio button and changed sort options, u'll have to chose another sort option, change order and than select again the desired sort option...
-
Ok it work, but not by sort whith comments!!!!!!
See example here: http://www.datenplatz.ch/leeger/gallery/categories.php?cat_id=9
I use the version with cookies.
???Does someone know why it dowsnt work???
-
Can anyone explain this?
I followed the instructions using the "cookie" method for part of step 1.3
I got this error message after I uploaded everything.
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/comicart/public_html/gallery/lang/english/main.php on line 376
Parse error: parse error, unexpected T_VARIABLE in /home/comicart/public_html/gallery/includes/page_header.php on line 303
Terry
-
Can anyone explain this?Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /home/comicart/public_html/gallery/lang/english/main.php on line 376
Parse error: parse error, unexpected T_VARIABLE in /home/comicart/public_html/gallery/includes/page_header.php on line 303
Sounds like you're missing a closing )
in main.php or one of the other files you modified. Recheck the syntax of the new language variables.
-
Turns out what caused the error (it seems) is copy and pasting the code in SAFARI.
I switched to MOZILLA and everything works just fine.
Go figure...
T
-
How many changes are lost in this code :wink:
Sincerly
vincent
-
How many changes are lost in this code :wink:
Sincerly
vincent
And, what was the best method, cookies or no cookies?
Why?
-
Hello!
i have just installed the MOD.
I got radio buttons for ASC and DESC instead of a selecting menu field.
What CODE i have to change to see a selecting menu like the one of the categorie selection.
I would prefer this.
My URL: www.industrie-gravuren.de/galerie
-
ok, u changed the code to have radio buttons instead of dropdown menu and now u want go back to dropdown instead of radio buttons?
I'm confused..
-
Sorry i was working on it and tried different codes.
Now it is working.
BUT i want to have a menu selection :!:
Do you have me an advice :?:
-
I might, but I dont understand what exactly are u trying to do...please be more describtive.
-
at V@no
ok i try to explain better. my english isn't the best.
Now you can see on my url www.industrie-gravuren.de/galerie that i have radio buttons to choose the sort direction ASC or DESC.
Instead of these buttons i would like to have a selection like the category or pics per page select.
I hope i could explain enough for you to understand me.
EDIT: I HAVE SEEN YOU HAVE WHAT I WANT TO HAVE ON YOUR URL. The sort selecting for ASC/DESC.
-
oh, I see...I didnt realize the default is radio buttons and not dropdown..
In Step 1.2 replace foreach ($image_sort_optionlist as $key => $val) {
$imgsort_dropdown .= "<INPUT type=\"radio\" name=\"imagessort\" value=\"$key\"";
if ($config['image_sort'] == $key) {
$imgsort_dropdown .= " checked";
}
$imgsort_dropdown .= ">".$val."\n";
}
with: $imgsort_dropdown .= "\n<select name=\"imagessort\" class=\"setperpageselect\">\n";
foreach ($image_sort_optionlist as $key => $val) {
$imgsort_dropdown .= "<option value=\"$key\"";
if ($config['image_sort'] == $key) {
$imgsort_dropdown .= " selected=\"selected\"";
}
$imgsort_dropdown .= ">".$val."</option>\n";
}
$imgsort_dropdown .= "</select>\n";
-
Thanks v@no
Now it looks like i would have it.
:) :D
-
at V@no
sorry, i have one more question.
i have seen on your page that you only have one "GO" Button for the two selections "sort by" and "pics per page".
This would be very kind if you could tell me the code for it, because i only have little space in the row. so it would be very good only to have one button for these selections.
And how do I become the whole line to center vertical?
Merci beaucoup.
-
not sure if it will work, but try insert {imgsort_dropdown_form} into setperpage_dropdown_form.html template
or if it doesnt work, then insert {setperpage_dropdown} into imgsort_dropdown_form.html template (u'll need remove "go" button from setperpage_dropdown_form.html template)
-
I removed the go button.
but now it is only changing the pics per page and i cannot recognize any sortation of images.
Could you give me the code of your imagesort_dropdown_form.html and setperpage_dropdown_form.html and also the page_header.php and lang/.../main.php
On your url its working perfect, but not for me.
-
Thanks a lot it works!
but if i sort my country Picture and start the flashshow the flashshow will take the default i belive because i did not use cockies!
sincerly
vincent
-
I added this MOD
the dropdown menu of sorting images is shown in the main categore not in the sub categories in each
is it woking like that ?
-
Thanks for the MOD, V@no!
I use this MOD, but a problem that default sorting for new photos should be by date. I've made the following changes, but for certain, it is possible to write a smaller size code (I haven't experience in PHP). :)
File: search.php
$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
$sql_where_query
AND c.cat_id = i.cat_id AND i.cat_id IN ($cat_id_sql)
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
change to
if ($search_new_images == 1) {
$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
$sql_where_query
AND c.cat_id = i.cat_id AND i.cat_id IN ($cat_id_sql)
ORDER BY ".image_date." ".DESC."
LIMIT $offset, $perpage";
} else {
$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
$sql_where_query
AND c.cat_id = i.cat_id AND i.cat_id IN ($cat_id_sql)
ORDER BY ".$config['image_order']." ".$config['image_sort']."
LIMIT $offset, $perpage";
}
-
And the simpliest way is to add above the original code block you've showed this:
if ($search_new_images == 1)
{
$config['image_order'] = "image_date";
$config['image_sort'] = "DESC";
}
-
Edit search.html template
-
@ Ivan,
dass die Auswahlleiste in der Erweiterten Suche angezeigt wird macht absolut Sinn ! Denn wenn ich Bilder zu einem bestimmten Keyword suche, dann kann ich hier gleich vorgeben (z.B. Anzahl der Postkarten) wonach das Suchergebnis sortiert werden soll. Beim Upload ... da hast du Recht ... macht die Sortierungsleiste nicht unbedingt Sinn.
mawenzi
-
Hey,
what if i want to sort the pictures in the categories by random?
Any ideas, or did i miss a thread??
Thanks in advance,
c-bass
-
I found out myself, now. It might be a MOD.
Go in categories.php to line 113 an replace:
$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
$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!
-
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
-
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
<form method="post" action="{self}">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>{lang_images_per_page} </td>
<td>{setperpage_dropdown} </td>
<td>{imgsort_dropdown_form}
<input type="submit" value="{lang_go}" class="button" name="submit" />
</td>
</tr>
</table>
</form>
Imgsort_dropdown_form
<FORM method="post" action="{self}">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<TD nowrap>{image_order} : </TD>
<TD nowrap>{imgsort_dropdown} </TD>
</tr>
</table>
</FORM>
-
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
<form method="post" action="{self}">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>{lang_images_per_page} </td>
<td>{setperpage_dropdown} </td>
<td>{imgsort_dropdown_form}
<input type="submit" value="{lang_go}" class="button" name="submit" />
</td>
</tr>
</table>
</form>
Imgsort_dropdown_form
<FORM method="post" action="{self}">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<TD nowrap>{image_order} : </TD>
<TD nowrap>{imgsort_dropdown} </TD>
</tr>
</table>
</FORM>
No One ?? :(
-
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
-
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/
-
Hi,
I want to add this MOD to sub_categories , so in what file to add {imgsort_dropdown_form}
thanks.
-
Great Mod, used it and is working perfectly. :)
http://messengerdp.com/categories.php?cat_id=9
-
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!
-
Do no need for session modify ... image size is no SQL but PHP from includes/functions.php file. ;)
Using GD - better result.
-
I haven't a clue what that means, sorry. :(
/php idiot
-
If for details page, use: {image_file_size} for see image filesize.
-
Well I try adding the following to my lang file in the image sort section,
"image_file_size" => "File Size"
When I chose the option on the main page I get the following SQL error...
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}?
-
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 ...
-
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
-
Ok but ... which place in 4images you want to show this ? ... site layout (left side), details ... categories page ? Please say detail ...
-
Just on the categories page...
i.e. > http://imgdump.info/cat-boats-647.htm
On the categories page I have the following code chunk...
{if thumbnails}<br>{imgsort_dropdown_form}<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>{thumbnails}</td>
</tr>
</table>
{endif thumbnails}
I put the {imgsort_dropdown_form} within the {if thumbnails} so it doesn't display unless there are images in the category.
-
Ok before you say file size and now is dropdown ... I no get what you try to do sorry.
-
Well the same way that this mod allows you to sort a category of images based on image_date, image_downloads, image_votes, or image_rating I would like to sort by the file size of the images.
Just a modification to this mod as is that lets you select "File Size" from that drop down list and sort the same way as the other options.
-
File size for categories ... ?
-
HY.
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
Haw can i make this.
Please help.
-
A have installed A-version of this MOD.
But the MOD doesn't work:
User selects to sort images (there is no matter how), but after reloading of a page nothing happens: the script of the 4images takes data from the cache folder!
Only Admin can refresh the cache folder manually. After refreshing of the cache folder MOD begins to sort images.
So, users use this MOD, but they get nothing after refreshing: script shows an old version of the page with date-sorting from cache folder!
How can we solve this problem with an old version of the page in cache folder?
-
File size for categories ... ?
Hmmm... let's see if I can explain this.
Let's say I have a gallery with five images.
Name Date Hits Downloads Size
Image 1 12/6 5 2 3.6MB
Image 2 6/3 100 4 1.6MB
Image 3 1/2 50 40 700KB
Image 4 3/9 10 0 10KB
Image 5 12/5 4 0 2.2MB
When you sort by hits descending while in the category the sort would go images 2, 3, 4, 1, 5.
I'd like to allow users to sort by size, where decending the order would be images 1, 5, 2, 3, 4
-
Nice Mod!
Läuft unter 1.7.6!
-
Kann ich bestätigen. Läuft ausgezeichnet unter 1.7.6.
Danke/Thanks great!
-
Hi, ich möchte die User nach Anzahl versendeter eCards sortieren lassen. Was muss ich ändern? Den MOD zum Zählen der Postkarten habe ich bereits installiert. (http://www.4homepages.de/forum/index.php?topic=10439.msg51881#msg51881)
Hi, how can visitors sort by number of ecards sent? I allready have this MOD installed (http://www.4homepages.de/forum/index.php?topic=10439.msg51881#msg51881)
Please help!
-
Hi, how can visitors sort by number of ecards sent? I allready have this MOD installed (http://www.4homepages.de/forum/index.php?topic=10439.msg51881#msg51881)
Please help!
Try use this code from Step 2.1:
//--------------Images Sort-------------------------
//---This was taken from /lang/YOURLANG/admin.php---
//--------------------------------------------------
$lang['image_order'] = "Sort images by";
$image_order_optionlist = array(
"image_name" => "Name",
"image_date" => "Date",
"image_downloads" => "Downloads",
"image_votes" => "Votes",
"image_rating" => "Rating",
"image_hits" => "Hits",
"image_postcards" => "Sent eCards",
);
$lang['image_sort'] = "Ascending/Descending";
$image_sort_optionlist = array(
"ASC" => "Ascending",
"DESC" => "Descending"
);
-
it works when using this in admin.php and main.php
thanks!
-
HI,
how i can make a LINK for the image-sort?
example: LINK for the most Hits:
<FORM method="post" action="{self}&imagesorder=image_hits&imagessort=DESC"> <INPUT type="submit" value="most seen" class="button" name="submit" /></FORM>
But it dont work. Anything Ideas?
thanks and greets
daniel
-
A have installed A-version of this MOD.
But the MOD doesn't work:
User selects to sort images (there is no matter how), but after reloading of a page nothing happens: the script of the 4images takes data from the cache folder!
Only Admin can refresh the cache folder manually. After refreshing of the cache folder MOD begins to sort images.
So, users use this MOD, but they get nothing after refreshing: script shows an old version of the page with date-sorting from cache folder!
How can we solve this problem with an old version of the page in cache folder?
Vano, the same problem with B-version. Is there any solution for make this MOD working with category caching?
-
... is deactivating of cache in global.php a solution for you ... ?
$cache_enable = 0;
... or only ...
$cache_page_categories = 0;
-
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 ?
-
in categories.php find:
$config['template_dir'],
insert below:
$config['image_sort'],
-
V@no,
thanks but it is not working. Does it affect both version (A and B), I've use B?
-
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
-
@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, $mode, 0, 1);
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
-
good morning v@no!
that´s great! it works perfect!
thank you!
bergblume!
-
@v@no
... the code snippet for bergblume is a nice and usefull extension ... thanks for sharing ...
-
V@no, and how to do same thing for search_new_images=1?
-
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";
-
V@no thank you very very much!!! This is what i need!!! :D
-
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:
$last_month = time() - 60 * 60 * 24 * 7 * 30;
-
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:
$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
-
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:
$cat_cache[$cat_id]['sort_field']
instead of
$config['image_order']
and
$cat_cache[$cat_id]['sort_order']
instead of
$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
-
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 != 0 )
{
$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 != 0 )
{
$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:
-
how to make work on home.html??
anyone know how to run this mod in the index and homer. Please!
-
how to make work on home.html??
...
what do you mean?
the mod works on home.html
or mean you, how sort the "New Images"? then search in index.php:
ORDER BY i.image_date DESC
and replace:
ORDER BY ".$config['image_order']." ".$config['image_sort'].", i.image_id ".$config['image_sort']."
Andi
-
That's what I wanted. thank you very much!!!
What should I add or modify to work also {setperpage_dropdown_form}??
-
search in index.php:
LIMIT $num_new_images";
and replace:
LIMIT $perpage";
-
ooo that simple
excuse my ignorance
thank you very much