January 7, 200521 yr I've read throught the documentation in FX.php as well as the FX.php in 8 hours booklet and can not find a way to specify the sort order in my query. for example I have a link that has <a href="clearance.php?currentSort=prod_sku<?php echo $currentSearch; ?>" class="whitetxt">Model #</a> What I would like to add is a descend sort order. I understand how to use the AddSortParam but I do not know how to have this work in a link.
January 7, 200521 yr Would you do this: <a href="clearance.php?currentSort=prod_sku<?php echo $currentSearch; ?>&sortOrder=<?php echo $sortOrder ?>" class="whitetxt">Model #</a> Good Luck. Garry
January 10, 200521 yr Author Well I was thinking more of simply having the sortOrder in the link itself. <a href="clearance.php?currentSort=prod_sku&sortOrder=:??" class="whitetxt">Model #</a>
January 10, 200521 yr If your link is initiating the search then you could have: <a href="clearance.php?currentSort=prod_sku&sortOrder=ascend" class="whitetxt">Model #</a> You would then have in the "clearance.php" file: $MyQuery->AddSortParam($_GET['currentSort'], $_GET['sortOrder']); All the best. Garry
January 13, 200521 yr Author I had forgotten to add the $_Get['sortOrder'] in my query. (Doh!) Thanks again, Garry for your help. Now would it be possible to have it so the sort toggles from ascend to descend on the same link? also what does $performOrder do in the AddSortParam function?
January 13, 200521 yr The "$performOrder" is used if you have more than one sort. You can determine in which order the sorts occur. What do you mean by "toggle on the same link"? Would you like some HTML/Javascript that toggles the value of the "sortOrder" parameter in the link? All the best. Garry
January 14, 200521 yr Author Example of toggle on a link would be HTML Table with several columns. First name, last name, date started, date finished etc. When you click on the First Name header in the table it would list the current first name query in alphabetical order a-z. When you clicked on the link again it would sort it in alphabetical order z-a. In essence changing the "sortOrder" parameter. I thought there would possibly be a way to toggle from ascend to descend. ******************** So how would $performOrder be used in a query? would it look something like this <a href="clearance.php?currentSort=prod_sku&sortOrder=ascend&performOrder=1¤tSort=prod_name&performOrder=2" class="whitetxt">Model #</a>
January 14, 200521 yr Re: <a href="clearance.php?currentSort=prod_sku&sortOrder=ascend&performOrder=1¤tSort=prod_name&performOrder=2" class="whitetxt">Model #</a> You cannot use the same paramenter name more than once is a URL. Hence: <a href="clearance.php?SortA=prod_sku&sortAOrder=ascend&SortAperform=1&SortB=prod_name&SortBperform=2" class="whitetxt">Model #</a> Re: be a way to toggle from ascend to descend You will have to write a way. This could be in either Javascript, DHTML/CSS or PHP. If it was Javascript or HTML this could be just a method of changing the value before the link is submitted. Else, with PHP you can rewrite the link depending on the previous order. All the best. Garry
January 14, 200521 yr Author I sort of understand the sort order but I thought that currentSort, sortOrder, and performOrder are functions in fx.php. How would I use the SortA, SortAOrder and SortAperform. With the fx.php functions? My apologies for the "newbie" questions.
January 14, 200521 yr Re: I thought that currentSort, sortOrder, and performOrder are functions in fx.php No, they are just variables used within the FX Class (FX.php). Hence, you shouldn't really use them. You should use your own variable/parameter names, then assign them to the FX object via the various Class Methods; such as "AddSortParam()". You might use them like this: $MyQuery->AddSortParam($_GET['SortA'], $_GET['SortAOrder'],$_GET['SortAperform']); $MyQuery->AddSortParam($_GET['SortB'], $_GET['SortBOrder'],$_GET['SortBperform']); All the best. Garry
Create an account or sign in to comment