Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Novice Programmer
Thanks Mathew,

This works like charm.. .thank you very much.

thanks.

On Sat, Nov 1, 2008 at 10:01 PM, Mathew <[EMAIL PROTECTED]> wrote:

>
> Sorry, my mistake.
>
> I forgot to tell you to remove the "array('pass'=>array('uid'))" from
> your routes, and then read the UID parameter from the $this-
> >params['uid'] in your Users controller Friends action.
>
> function friends()
> {
>  $uid = $this->params['uid'];
> }
>
> You'll need to check if isset($this->params['uid']), because /users/
> friends unless routed to a 404 will still call the same action without
> a UID.
> >
>


-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Novice Programmer
Just noted that every thing works well if route is defined as:

Router::connect('/users/friends/:uid/*', array('controller' => 'users',
'action' => 'friends'),
array('pass'=>array('uid')));

Thanks.

On Sat, Nov 1, 2008 at 9:55 PM, Novice Programmer
<[EMAIL PROTECTED]>wrote:

> Hello Mathew,
>
> I tried this option as well ...
> $paginator->options(array('url' =>array('uid'=>$this->params['uid'])));
>
> but the url produced looks like:
> http://x.com/users//friends//page:2
>
> where as i expect it to be:
> http://x.com/users//friends/page:2
>
> Dont know whats wrong with my parameter passing.. :(
>
> Thanks.
>
>
>
>
> On Sat, Nov 1, 2008 at 8:53 PM, Mathew <[EMAIL PROTECTED]> wrote:
>
>>
>> Hi Novice,
>>
>> There are a couple of things here.
>>
>> Router::connect('/users/:uid/friends/*', array('controller' =>
>> 'users','action' => 'friends'),array('pass'=>array('uid')));
>>
>> This is not a named parameter, because you are passing the argument
>> "uid" to the controller's action as a function argument.
>>
>> The syntax ":uid" looks like a named parameter, but it is not a named
>> parameter. Named parameters must be registered with the Router using
>> the "connectNamed" method before defining your routes.
>>
>> CakePHP comes with a collection of predefined named parameters. Such
>> as those found in the paginate helper.
>>
>> Still, there is nothing wrong with your routing. To have paginate
>> generate router friendly URIs you need to tell it about the UID
>> arguments.
>>
>> In your view add the following.
>>
>> $paginator->options(array('url' =>array('uid'=>$this-
>> >params['uid'])));
>>
>> >>
>>
>
>
> --
> Thanks & Regards,
> Novice.
>



-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Mathew

Sorry, my mistake.

I forgot to tell you to remove the "array('pass'=>array('uid'))" from
your routes, and then read the UID parameter from the $this-
>params['uid'] in your Users controller Friends action.

function friends()
{
  $uid = $this->params['uid'];
}

You'll need to check if isset($this->params['uid']), because /users/
friends unless routed to a 404 will still call the same action without
a UID.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Novice Programmer
Hello Mathew,

I tried this option as well ...
$paginator->options(array('url' =>array('uid'=>$this->params['uid'])));

but the url produced looks like:
http://x.com/users//friends//page:2

where as i expect it to be:
http://x.com/users//friends/page:2

Dont know whats wrong with my parameter passing.. :(

Thanks.



On Sat, Nov 1, 2008 at 8:53 PM, Mathew <[EMAIL PROTECTED]> wrote:

>
> Hi Novice,
>
> There are a couple of things here.
>
> Router::connect('/users/:uid/friends/*', array('controller' =>
> 'users','action' => 'friends'),array('pass'=>array('uid')));
>
> This is not a named parameter, because you are passing the argument
> "uid" to the controller's action as a function argument.
>
> The syntax ":uid" looks like a named parameter, but it is not a named
> parameter. Named parameters must be registered with the Router using
> the "connectNamed" method before defining your routes.
>
> CakePHP comes with a collection of predefined named parameters. Such
> as those found in the paginate helper.
>
> Still, there is nothing wrong with your routing. To have paginate
> generate router friendly URIs you need to tell it about the UID
> arguments.
>
> In your view add the following.
>
> $paginator->options(array('url' =>array('uid'=>$this-
> >params['uid'])));
>
> >
>


-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Mathew

Hi Novice,

There are a couple of things here.

Router::connect('/users/:uid/friends/*', array('controller' =>
'users','action' => 'friends'),array('pass'=>array('uid')));

This is not a named parameter, because you are passing the argument
"uid" to the controller's action as a function argument.

The syntax ":uid" looks like a named parameter, but it is not a named
parameter. Named parameters must be registered with the Router using
the "connectNamed" method before defining your routes.

CakePHP comes with a collection of predefined named parameters. Such
as those found in the paginate helper.

Still, there is nothing wrong with your routing. To have paginate
generate router friendly URIs you need to tell it about the UID
arguments.

In your view add the following.

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

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Novice Programmer
Hello recardoe,

I tried hard by changing around the options but to no use. I doubt that
there is a custom routing support with pagination... :(.

thanks.

On Sat, Nov 1, 2008 at 1:29 PM, ricardoe <[EMAIL PROTECTED]> wrote:

>
> Hi, I really don't know if this is useful, but read the bottom lines
> of http://book.cakephp.org/view/166/Pagination-in-Views
> Maybe you can tweak it.
>
> Regards
>
> On 1 nov, 01:15, "Novice Programmer" <[EMAIL PROTECTED]> wrote:
> > Any ideas on what this can be?
> >
> > Thanks.
> >
> > On Sat, Nov 1, 2008 at 5:28 AM, Novice Programmer
> > <[EMAIL PROTECTED]>wrote:
> >
> >
> >
> > > Hello guys,
> >
> > > I have defined following route in routes.php:
> > > Router::connect('/users/:uid/friends/*', array('controller' => 'users',
> > > 'action' => 'friends'),
> > > array('pass'=>array('uid')));
> >
> > > when i try to use paginator to build pagination links, the links to
> pages
> > > look like the default cake php route:
> > > they look as /users/friends//page:1 where as using the above
> route, i
> > > expect them to be: /users//friends/page:1.
> >
> > > I am confused whether this a bug or feature? My pagination code for
> > > building the links:
> >
> > > last(' > > height="18" />',
> > > array('escape'=>false));?>
> >
> > > numbers(); ?>
> >
> > > My paginate setup:
> >
> > > $this->paginate = array('limit'=>1,
> > > 'page'=>1,
> > > 'order'=>'UsersFriend.created DESC',
> > > 'contain'=>array('User', 'Profile'));
> >
> > > $data = $this->paginate('UsersFriend',
> > >
> array('UsersFriend.user_id'=>$user['User']['id']));
> >
> > > Please help.
> >
> > > --
> > > Thanks & Regards,
> > > Novice.
> >
> > --
> > Thanks & Regards,
> > Novice.
>
> >
>


-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread ricardoe

Hi, I really don't know if this is useful, but read the bottom lines
of http://book.cakephp.org/view/166/Pagination-in-Views
Maybe you can tweak it.

Regards

On 1 nov, 01:15, "Novice Programmer" <[EMAIL PROTECTED]> wrote:
> Any ideas on what this can be?
>
> Thanks.
>
> On Sat, Nov 1, 2008 at 5:28 AM, Novice Programmer
> <[EMAIL PROTECTED]>wrote:
>
>
>
> > Hello guys,
>
> > I have defined following route in routes.php:
> > Router::connect('/users/:uid/friends/*', array('controller' => 'users',
> > 'action' => 'friends'),
> >             array('pass'=>array('uid')));
>
> > when i try to use paginator to build pagination links, the links to pages
> > look like the default cake php route:
> > they look as /users/friends//page:1 where as using the above route, i
> > expect them to be: /users//friends/page:1.
>
> > I am confused whether this a bug or feature? My pagination code for
> > building the links:
>
> > last(' > height="18" />',
> >                                     array('escape'=>false));?>
>
> > numbers(); ?>
>
> > My paginate setup:
>
> > $this->paginate = array('limit'=>1,
> >                         'page'=>1,
> >                         'order'=>'UsersFriend.created DESC',
> >                         'contain'=>array('User', 'Profile'));
>
> >                 $data = $this->paginate('UsersFriend',
> >                         array('UsersFriend.user_id'=>$user['User']['id']));
>
> > Please help.
>
> > --
> > Thanks & Regards,
> > Novice.
>
> --
> Thanks & Regards,
> Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Named parameter routing does not work with pagination(bug or feature?)

2008-11-01 Thread Novice Programmer
Any ideas on what this can be?

Thanks.

On Sat, Nov 1, 2008 at 5:28 AM, Novice Programmer
<[EMAIL PROTECTED]>wrote:

> Hello guys,
>
> I have defined following route in routes.php:
> Router::connect('/users/:uid/friends/*', array('controller' => 'users',
> 'action' => 'friends'),
> array('pass'=>array('uid')));
>
> when i try to use paginator to build pagination links, the links to pages
> look like the default cake php route:
> they look as /users/friends//page:1 where as using the above route, i
> expect them to be: /users//friends/page:1.
>
> I am confused whether this a bug or feature? My pagination code for
> building the links:
>
> last(' height="18" />',
> array('escape'=>false));?>
>
> numbers(); ?>
>
> My paginate setup:
>
> $this->paginate = array('limit'=>1,
> 'page'=>1,
> 'order'=>'UsersFriend.created DESC',
> 'contain'=>array('User', 'Profile'));
>
> $data = $this->paginate('UsersFriend',
> array('UsersFriend.user_id'=>$user['User']['id']));
>
>
> Please help.
>
>
> --
> Thanks & Regards,
> Novice.
>



-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Named parameter routing does not work with pagination(bug or feature?)

2008-10-31 Thread Novice Programmer
Hello guys,

I have defined following route in routes.php:
Router::connect('/users/:uid/friends/*', array('controller' => 'users',
'action' => 'friends'),
array('pass'=>array('uid')));

when i try to use paginator to build pagination links, the links to pages
look like the default cake php route:
they look as /users/friends//page:1 where as using the above route, i
expect them to be: /users//friends/page:1.

I am confused whether this a bug or feature? My pagination code for building
the links:

last('',
array('escape'=>false));?>

numbers(); ?>

My paginate setup:

$this->paginate = array('limit'=>1,
'page'=>1,
'order'=>'UsersFriend.created DESC',
'contain'=>array('User', 'Profile'));

$data = $this->paginate('UsersFriend',
array('UsersFriend.user_id'=>$user['User']['id']));


Please help.


-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---