I currently use the lame paging with the include Dreamweaver codes. This class is MAGNIFICIENT!!! I love it!!!
WARNING: THIS IS well thought out post, and long. However, you may find the results very useful if you ever need to use drop-downs to filter a page results and keep those results consistent while utilizing this class.
Therefore, I believe it is worth reading my post. I know forums are filled with morons (usually ones like me...) ranting on and on. Well I am sorry for the length, but it is packed with useful information to help you solve my problem, and possibly provide a good on-going solution for future use.
Thanks for your time in advance. It is much appreciated!
I have a page which uses drop downs to filter the search results which uses javascript to keep the results persistent.
Here is the page in Question
CLICKIE (http://www.studioauditions.com/industrynews_home_paging.php)
I have successfully gotten the paging class to recognize that I have 579 records and it makes the proper paging show up on the page, but because of my javascript and the necessary _GET variables, the pages don't persistently hold on to the submitted information, and therefore cause the class.pager to not work -- meaning, the clickies always take you to the first page's results even though the class thinks otherwise.
What is cool though is the javascript is being useful to the class, because if you do filter the page using my javascript scripts and click the GO button, the class recognizes the difference in the findings. Notice the change in the number of pages and record count.
I have a feeling I can probably lose all my javascript to make it somehow persistent utilizing just the class....who knows really....but the php that generates the page is complex enough that I am not looking for best-practice, I am looking for best-FIX....seriously.
Here are the _GET variables that keep my world persistent currently
?pageNum_rsWritings=1&maxRows_rsWritings=10&totalRows_rsWritings=579&_p=4&selectWritingCat=0&selectManuf=0&selectDate=0
Or more elegantly for those willing to help code up something for me
(Filled with sample values from the second page when the current NEXT link is clicked at the bottom of the page.)
pageNum_rsWritings=1
maxRows_rsWritings=10
totalRows_rsWritings=579
selectWritingCat=0
selectManuf=0
selectDate=0
Also, Noteworthy -- my pageNum_rsWritings is really doing what the _p variable is doing in the class, however, mine is array based, so when _p would equal 1, mine equals 0.
So long story longer, what I need is a way to echo the links to the page, but have the the submitted links, when clicked, (the page numbers inside the class deployment that is) carry forward the above mentioned _GET URL variables in them.
Below is the javascript that you could view in the page if you viewed source.
function GetFilters() {
rtnString = "selectWritingCat=" + document.form1.selectWritingCat.value + "&selectManuf=" + document.form1.selectManuf.value + "&selectDate=" + document.form1.selectDate.value;
return rtnString;
}
function FilteredPaging(url, paging) {
if (document.form1.filterChanged.value == "true") {
window.location = url + "?" + GetFilters();//CHANGED HERE
} else {
window.location = url + "?" + paging + "&" + GetFilters(); // CHANGED HERE
}
}
function ReloadPage(url) {
window.location = url + "?" + GetFilters();
}
And below is the php code that currently makes the HACKY Dreamweaver generated NEXT link actually work.
<a href="javascript:FilteredPaging('<?php echo $currentPage; ?>','<?php printf("pageNum_rsWritings=%d&maxRows_rsWritings=%d%s", min($totalPages_rsWritings, $pageNum_rsWritings + 1), $maxRows_rsWritings, $queryString_rsWritings); ?>')">Next</a>
Right now, if you filter the page, it holds onto the values it needs. But when you click the number links from the class, it submits the _GET variables that hold the manufacturer and category, but the _p=2 code is for some reason not recognized.
The code that would be great to add, but I don't understand how to alter the {LINK_LINK} variables, would be to in addition to the _p appended to the URL value...
another _GET variable is added which would be equal to
_p - 1 : due to my array difference...meaning, my zero page equals the class's 1 page.
So --- if you manually past in the address bar the pageNum_rsWritings=(whatever the _p - 1 value would be) it goes to the right page!
So the real question is HOW do I append that the string URL that gets submitted?
Again, I would like to say that this class is RE-Donkulously perfect for my needs and I absolutely love it.
I am sincerely hopeful that what I am asking is understandable and helps someone else out when we find the solution.
Working together we can solve world hunger! Or maybe just help some audio-phyles find their articles faster....either way I am happy.