The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Problem with pagination URL
Hello all,
Does anybody know what appears in the URL when one parameter is array? eg: &genders=Array&roles=Array is correct? Actually it must be correct as the pagination works just fine (I mean navigating between the pages), but I can't get the values for another action that I want. Testing the 1st page with: Code:
if (is_array($genders)) { echo "1"; print_r($genders); } The most important parts of the code before are: Code:
$vbulletin->input->clean_array_gpc('r', array( 'homeform' => TYPE_INT, 'genders' => TYPE_ARRAY_INT, 'roles' => TYPE_ARRAY_INT, .... )); $genders = $vbulletin->GPC['genders']; $roles = $vbulletin->GPC['roles']; // Below I've the code for counting the amount of rows etc etc. .......... // Storing the values to pass them as parameters $postvalues .= "&genders=".$genders; $postvalues .= "&roles=".$roles; // Finally building the page navigation $pagenav = construct_page_nav($pagenumber, $perpage, $records, 'dating.php?' . $vbulletin->session->vars['sessionurl'] . 'do=searchresults'.$postvalues.''); Code:
$postvalues .= "&genders=".implode(',',$genders); Any idea is welcome Thank you |
#2
|
||||
|
||||
Since you are getting passed a single value (ie. initially it is genders=1 or genders=2, right?), then it is simply a string or integer at that point - it isn't an array that is getting passed via the URL.
|
#3
|
||||
|
||||
Quote:
No, I'm passimg array of values from the initial form to genders[]. The first page works just fine. I'm using these array values to preselect the form that exists in the searchresults page. The problem starts to appear when I'm navigating to any other page using the pagination (always on the same php file/page). The navigation works, but I'm loosing the values of the variables. Maybe the solution can be childish. Is that $postvalues at the end of: Code:
$pagenav = construct_page_nav($pagenumber, $perpage, $records, 'dating.php?' . $vbulletin->session->vars['sessionurl'] . 'do=searchresults'.$postvalues.''); Thank you again |
#4
|
||||
|
||||
You're passing an actual array? What does this URL look like initially - &genders=1,2&roles=1,2 ?
|
#5
|
||||
|
||||
Quote:
Code:
$postvalues .= "&genders=".implode(',',$genders); $postvalues .= "&roles=".implode(',',$roles); Code:
$postvalues .= "&genders=".$genders; $postvalues .= "&roles=".$roles; |
#6
|
||||
|
||||
I notice you aren't separating the post variables with "&" which would need to be done after do=searchresults (the session variable has one at the end). So, you need to fix that. But, I'd also suggest looking at the construct_page_nav function (in functions.php) because I'm not totally sure if it is set up to handle and array being passed.
|
#7
|
||||
|
||||
Finally I was able to solve the problem and I'm posting the solution here just in case someone else finds the same problem when passing arrays in URL. The trick is to use serialize/unserialize.
So in the passing to the URL you use: PHP Code:
PHP Code:
|
Благодарность от: | ||
Lynne |
#8
|
||||
|
||||
I'm glad you figured it out and thanks for posting the solution.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|