paging problem
7 posts by 2 authors in: Forums > CMS Builder
Last Post: January 16, 2009 (RSS)
By jsantari - January 13, 2009
The problem I am having is with paging of the comments.
Example: if I page to the second comments page the page displays the news item and page 2 of the comments just fine. However, if I page to page 3 or back to page 1, even though the url is correct the wrong news item page displays?
I am using the getNumberFromEndOfUrl() function to grab the num value from the news item and then using it in the where clause of the comments viewer. The strange part of this is that the url on the paging link and in the address bar are correct but it goes to the wrong news item.
Any ideas as to why this happens?
Re: [jsantari] paging problem
By Dave - January 13, 2009
Do you have an example url where we can see the issue?
My first guess is that when you link to page 1, or 3 of the comments the url looks like this: yourViewer.php?page=3 and getNumberFromEndOfUrl() is mistakenly getting that 3 as the record number.
Some solutions would be to show the comments in an iframe so their url could change without changing the content on the page. Or passing the record num as num=123 and pulling it into the where like this:
'where' => "num = '" .mysql_real_escape_string(@$_REQUEST['num']). "' ",
Hope that helps, let me know if one of those solutions will work for you.
interactivetools.com
Re: [Dave] paging problem
By jsantari - January 14, 2009
Re: [jsantari] paging problem
By Dave - January 14, 2009
Generally it works well when you're just passing the record number, but if you have multiple values you need to pass them manually and load the values or at the last make sure the record number is on the end. eg: ?page=2&num=1
interactivetools.com
Re: [Dave] paging problem
By jsantari - January 14, 2009
$url = explode('=&',$urlData);
$urlData = $url[0];
It makes $urlData always contain just the url we want to strip the num off of.
Jim
Re: [jsantari] paging problem
By Dave - January 15, 2009
Interesting. We won't be able to add that to viewer_functions.php because some people rely on the currently functionality of getting the number from the end of the url (instead of the beginning of the url).
To make your version upgrade proof I'd suggest creating a copy of the function called getNumberFromUrl() or something else and calling that one.
Hope that helps. Let me know if you need anything else.
interactivetools.com
Re: [Dave] paging problem
By jsantari - January 16, 2009
I have created a second function in my own lib file as you suggested and it works fine.
Thanks,
Jim