On further investigation, the following bit of code fixes this issue.
Please put it in the next release.
File cake/libs/view/helpers/paginator.php line 318 change from:
$url = array_merge(array('page' => $paging['page'] + ($which ==
'Prev' ? $step * -1 : $step)), $url);
to:
if ( is_array ( $url ) ) {
$url = array_merge(array('page' => $paging['page'] + ($which ==
'Prev' ? $step * -1 : $step)), $url);
} else {
$url = array ( $url ) + array('page' => $paging['page'] +
($which ==
'Prev' ? $step * -1 : $step));
}
On 22 Sep, 12:02, Mal <[email protected]> wrote:
> Hi all,
>
> the following problem manifests itself in both cake 1.2.4 and 1.2.5.
>
> I have a requirement to pass an ID into the index action of a
> controller that uses the cake paginator.
> The url would look something like this "http://server/path/controller/
> index/135".
>
> I can generate the url easily for most references to the page (as
> suggested by the cake manual).
> However, I have a problem generating the correct url from the
> paginator.
> Here is the code I use in the view ($extra is the ID to embed in the
> url, 135 in this case):
> $options = array ( 'before' => ' | ', 'after' => ' | ' );
> if ( ! empty ( $extra ) ) {
> $options += array ( 'url' => $extra );
> }
> echo $paginator->first('<< '.__('First', true), $options, null, array
> ('class'=>'disabled'));
> echo $paginator->prev('< '.__('previous', true), $options, null, array
> ('class'=>'disabled'));
> echo $paginator->numbers( $options );
> echo $paginator->next(__('next', true).' >', $options, null, array
> ('class'=>'disabled'));
> echo $paginator->last(__('last', true).' >>', $options, null, array
> ('class'=>'disabled'));
>
> The 'first', 'numbers' and 'last' methods all generate the correct
> url: "http://server/path/controller/index/135/page:2".
>
> However, the 'next' and 'last' methods generate this error: "Warning
> (2): array_merge() [function.array-merge]: Argument #2 is not an array
> [CORE/cake/libs/view/helpers/paginator.php, line 318]"
> and produce this url: "http://server/path/controller/%3C%20previous"
>
> I tried supplying the ID as an array to 'prev' and 'next' only:
> $options += array ( 'url' => array ( 'ID' => $extra ) );
> but that generates this url: "http://server/path/controller/page:2/ID:
> 135"
>
> Is this a bug? Has anyone got a workaround?
>
> I have not tried the 'sort' method yet to see if that is affected.
>
> Thanks for any help
>
> Mal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---