Hi.

I believe I've found a bug in CakePHP, but as Occam's razor means it's
more likely to be something I'm personally doing wrong, I felt I
should ask here first.

I've set up a few prefixes in /app/config/routes.php like this:

        Router::Connect('/some_prefix/:controller/:action/*', array(
                'prefix' => 'some_prefix',
                'some_prefix' => true
        ));

        Router::Connect('/some_other_prefix/:controller/:action/*',
array(
                'prefix' => 'some_other_prefix',
                'some_other_prefix' => true
        ));

I've also updated how I'm using the paginator, based on the advice at
http://www.pagebakers.nl/2008/12/04/cakephp-router-and-prefixes/ , to
this:

$paginator->options(array(
  'url' => array(
    $this->params['prefix'] => true
  )
));

unset($this->params['named']['page']);

echo $paginator->first('<img src="/img/silk/control_start_blue.png" /
>', array(
  'escape' => false,
  'url' => $this->params['named']
));

if ($paginator->hasPrev() == false) {
  echo '<img src="/img/silk/control_start.png" />';
}

echo $paginator->prev('<img src="/img/silk/control_rewind_blue.png" /
>', array(
  'escape' => false,
  'url' => $this->params['named']
), '<img src="/img/silk/control_rewind.png" />', array(
  'escape' => false
));

echo $paginator->next('<img src="/img/silk/
control_fastforward_blue.png" />', array(
  'escape' => false,
  'url' => $this->params['named']
), '<img src="/img/silk/control_fastforward.png" />', array(
  'escape' => false
));

echo $paginator->last('<img src="/img/silk/control_end_blue.png" />',
array(
  'escape' => false,
  'url' => $this->params['named']
));

if ($paginator->hasNext() == false) {
  echo '<img src="/img/silk/control_end.png" />';
}

This works fine for prev() and next(), but first() last() don't work.
I get the following links on page 2 of a paginated list of countries,
for example:

First: http://example.com/countries/some_prefix_index/page:1
Prev: http://example.com/some_prefix/countries/index/page:1
Next: http://example.com/some_prefix/countries/index/page:3
Last: http://example.com/countries/some_prefix_index/page:13

Is there something I'm missing, or have I stumbled across a genuine
bug?

Thanks for your help,
Zoe.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to