Using the latest svn version i was making a simple paginated list
inside the admin section:
it was called from:
/admin/news/index
the code used in the controller is:
function admin_index()
{
$news = $this-paginate('News');
$this-set('news', $news);
}
the view code (with paginator helper) is simple from my point of view:
tr
th?php echo $paginator-sort('Id', 'id');?/th
th?php echo $paginator-sort('Categoru',
'category_id');?/th
th?php echo $paginator-sort('Titlte', 'title');?/th
th?php echo $paginator-sort('Date', 'created');?/th
/tr
the problem here is that the url formed by Router is not extracting
the admin_ part from the url, so the link points here:
/admin/news/admin_index/page:1/sort:category_id/direction:asc
this obviously generates an error because admin_index is pointed to
admin_admin_index method, that doesn't exists.
If i forced the action with this:
$this-paginate['options']['action'] = 'index';
the link now is well formed but the direction clause is never changed,
getting all the time the Ascending direction.
I look throught the Router code and i didn't found anything strange,
i tried to modify the lines 674 to 680 in cake/libs/router.php with
this hackish and ugly code only to see if works:
if ($admin) {
if (!isset($url[$admin])
!empty($params[$admin])) {
$url[$admin] = true;
if (substr($url['action'], 0, 6) ==
'admin_')
$url['action'] = str_replace('admin_',
'', $url['action']);
} elseif ($admin array_key_exists($admin,
$url) !
$url[$admin]) {
unset($url[$admin]);
}
}
and now everythings works fine, i know that this isn't the better
solution, but i run all the controller and paginator helper tests and
all passes. It's to late here in argentina and i'm still at work, when
i arrive home i'll be looking to create some tests that reproduce this
¿bug? or im missing something?
Thanks in advance
gonzalo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups Cake
PHP group.
To post to this group, send email to cake-php@googlegroups.com
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
-~--~~~~--~~--~--~---