Odd values for prev and next page links

11 posts by 4 authors in: Forums > CMS Builder
Last Post: June 5, 2012   (RSS)

By zip222 - January 16, 2011 - edited: January 16, 2011

I am getting what I think is an odd value for both the previous and next page links:

$portfolioMetaData['prevPageLink']
gives me: ?portfolio=&index.php=&page=1

$portfolioMetaData['nextPageLink']
gives me: ?portfolio=&index.php=&page=3


This is causing issues with my ability to use the allow search feature. here is the relevant code I am using...

list($portfolioRecords, $portfolioMetaData) = getRecords(array(
'tableName' => 'portfolio',
'allowSearch' => '1',
'perPage' => '6',
));


<div class="pagination">
<?php if ($portfolioMetaData['prevPage']): ?>
<a href="<?php echo $portfolioMetaData['prevPageLink'] ?>">&lt;</a>
<?php else: ?>
<a class="inactive">&lt;</a>
<?php endif ?>

<?php
if (@!$_GET['page']): $current_page = "1";
else: $current_page = $_GET['page'];
endif;
?>

<?php foreach (range(1,$portfolioMetaData['totalPages']) as $page): ?>
<?php if ($page == $current_page): ?>
<a class="current"><?php echo $page; ?></a>
<?php else: ?>
<a href="?page=<?php echo $page; ?>"><?php echo $page; ?></a>
<?php endif ?>
<?php endforeach; ?>

<?php if ($portfolioMetaData['nextPage']): ?>
<a href="<?php echo $portfolioMetaData['nextPageLink'] ?>">&gt;</a>
<?php else: ?>
<a class="inactive">&gt;</a>
<?php endif ?>
</div>

Re: [zip222] Odd values for prev and next page links

By Jason - January 17, 2011

Hi Zip,

If you could fill out a [url http://www.interactivetools.com/support/]2nd Level Support Request[/url] I can take a closer look into this.

In the comments of the request, be sure to indicate which .php file is experiencing the problem.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Odd values for prev and next page links

By Perchpole - June 2, 2012

Hello, All -

Did you ever resolve this issue? If so I wonder if it would help me with my issue? I'm also getting some weird results in my pagination links.

This is the showme output:

Array
(
[invalidPageNum] =>
[noRecordsFound] =>
[page] => 2
[perPage] => 12
[fromCache] => 0
[totalPages] => 2
[totalRecords] => 15
[pageResultsStart] => 13
[pageResultsEnd] => 15
[prevPage] => 1
[nextPage] =>
[prevPageLink] => /index.php?cat=6&amp;amp;gal=13&amp;page=1
[nextPageLink] => /index.php?cat=6&amp;amp;gal=13&amp;page=
[firstPageLink] => /index.php?cat=6&amp;amp;gal=13&amp;page=1
[lastPageLink] => /index.php?cat=6&amp;amp;gal=13&amp;page=2
[_detailPage] =>
[_listPage] => javascript:alert('Set List Page Url for this section in: Admin &gt; Section Editors &gt; Record &gt; Viewer Urls')
)


The generated links are full of ampersands - which is having a serious knock on effect for some of my other page code.

What's causing this?

:0/

Perch

Re: [Perchpole] Odd values for prev and next page links

By Jason - June 4, 2012

Hi Perch,

The links are generated to have all the same data currently in the URL plus a "page" variable at the end. When outputted, all the &amp; values should be evaluated as & (ie, index.php?cat=6&gal=13&page=1).

Are you experiencing something different? What effect is this having on the rest of your code?
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Odd values for prev and next page links

By Perchpole - June 4, 2012

Hi, Jason -

As you can see from the code above, the next/prev links contain multiple ampersands. This has the effect of breaking some of the code on the pages. The $_GET requests seem to fail, for example.

:0/

Perch

Re: [Perchpole] Odd values for prev and next page links

By Dave - June 5, 2012

Hi Perch,

Can you click on phpinfo under: Admin > General (at the bottom),
or just use this link: admin.php?menu=admin&action=phpinfo

And let me know what it says for: arg_separator.output

We're using a PHP function called http_build_query() to build urls that uses that value as a separator. My first guess is it has a different value than what is expected (which is &).

Let me know and I'll work on a fix for you. Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Odd values for prev and next page links

By Perchpole - June 5, 2012

Hi, Dave -

It reads:

arg_separator.input &
arg_separator.output &amp;


:0)

Perch

Re: [Perchpole] Odd values for prev and next page links

By Dave - June 5, 2012

Hi Perch,

Try this fix with a recent CMSB version:

- Edit /cmsAdmin/lib/init.php
- Search for: zlib.output_compression
- Add the code in red below the zlib code:

// disable zlib.output_compression so we...
@ini_set('zlib.output_compression', 0);

// Set PHP arg_separator.output value to & so PHP http_build_query() function always works as expected
ini_set('arg_separator.output', '&');


Let me know if that works for you. Thanks!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Odd values for prev and next page links

By Perchpole - June 5, 2012

Hi, Dave -

That's perfect. Was my setting unusual?

:0S

Perch