Re: Paginator and subdirectory

2008-05-16 Thread b logica

What I need, friend, is to thank you profusely! That works like a charm.

I had:

Router::connect('/membership/members', array('controller' =>
'members', 'action' => 'index'));

And I didn't think it was important because this was about Paginator
passing info to Router. It hadn't occurred to me that Router would
consider existing routes like that. Freaking brilliant!


On Fri, May 16, 2008 at 9:04 AM, grigri <[EMAIL PROTECTED]> wrote:
>
>> There's not much to show. All I want to do is prepend '/membership/'
>> to all members routes.
>
> this works fine for me:
>
> -- routes.php --
> Router::connect('/membership/members/:action/*', array('controller' =>
> 'members'));
>
> Nothing special at all in the controller or view. Works with scaffold,
> works with your example controller action and view, works with
> pagination options [although I didn't specify a url parameter at all].
>
> Go to /members/ and the 'next' link points to /membership/members/
> index/page:2
> Go to /membership/members/ and it's the same
>
> All urls for members work with and without the /membership prefix
> [that's index, add, view and delete], and all urls generated contain
> the prefix.
>
> Is that what you need?
> >
>

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-16 Thread grigri

> There's not much to show. All I want to do is prepend '/membership/'
> to all members routes.

this works fine for me:

-- routes.php --
Router::connect('/membership/members/:action/*', array('controller' =>
'members'));

Nothing special at all in the controller or view. Works with scaffold,
works with your example controller action and view, works with
pagination options [although I didn't specify a url parameter at all].

Go to /members/ and the 'next' link points to /membership/members/
index/page:2
Go to /membership/members/ and it's the same

All urls for members work with and without the /membership prefix
[that's index, add, view and delete], and all urls generated contain
the prefix.

Is that what you need?
--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-16 Thread Marcin Domanski
try

var $paginate = array(
   'url' => array('controller' => 'members', 'action' => 'index'),

On Fri, May 16, 2008 at 12:42 AM, b logica <[EMAIL PROTECTED]> wrote:
>
> There's not much to show. All I want to do is prepend '/membership/'
> to all members routes.
>
> This works fine:
> Router::connect('/membership/members', array('controller' =>
> 'members', 'action' => 'index'));
>
> MembersController:
>
> var $paginate = array(
>'url' => array('/membership/members'),
>'limit' => 20,
>'page' => 1,
>'order' => array('Member.last_name' => 'ASC'),
>'fields' => array(
>'Member.id',
>'Member.first_name',
>'Member.last_name',
>'Member.slug'
>)
> );
>
> function index()
> {
>$this->Member->recursive = 0;
>$this->set('members', $this->paginate());
> }
>
> view:
>
> prev() . ' ' . $paginator->numbers() . ' ' .
> $paginator->next(); ?>
>
> The "next" link is created as /members/index/page:2
>
> I've tried adding the URL to these methods in several ways, debugging
> in Paginator, but nothing's worked. I don't kow if this is a
> shortcoming of either Paginator or Route, or if I just haven't
> uncovered the magic formula to pass.
>
> On Thu, May 15, 2008 at 6:11 PM, Nicolás Andrade
> <[EMAIL PROTECTED]> wrote:
>> I would like to see each php code and the resulting HTML link, if possible.
>>
>> It might help us to help you.
>>
>>
>>
>>
>>
>> On Thu, May 15, 2008 at 6:36 PM, b logica <[EMAIL PROTECTED]> wrote:
>>>
>>> Speaking of generic, I'm wondering if Nicolás' bug is more of an admin
>>> routing one or something specific to pagination/routing. IOW, I still
>>> don't know if what I want to do has an existing solution or I need to
>>> hack Router as well. For the moment, I'm rolling my own pagination but
>>> I'd really prefer to use something built-in.
>>>
>>> On Thu, May 15, 2008 at 4:46 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>>> > On Thu, May 15, 2008 at 4:32 PM, Nicolás Andrade
>>> > <[EMAIL PROTECTED]> wrote:
>>> >>
>>> >>
>>> >> To solve my issue, I've added the following lines:
>>> >>
>>> >> if(strpos($url['action'],
>>> >> Configure::read('Routing.admin') .
>>> >> '_') !== false){
>>> >> $url['action'] =
>>> >> str_replace(Configure::read('Routing.admin') . '_' , '',
>>> >> $url['action']);
>>> >> }
>>> >>
>>> >> in /cake/libs/router.php, line 749 aprox.
>>> >
>>> > Please file a ticket over at trac.cakephp.org about this, as it might
>>> > be something that can be fixed in a more generic way.
>>> >
>>> > --
>>> > Chris Hartjes
>>> > Internet Loudmouth
>>> > Motto for 2008: "Moving from herding elephants to handling snakes..."
>>> > @TheKeyBoard: http://www.littlehart.net/atthekeyboard
>>> >
>>> > >
>>> >
>>>
>>>
>>
>>
>>
>> --
>> Nicolás Andrade
>> www.nicoandra.com.ar
>> www.treintaguita.com.ar
>> >
>>
>
> >
>



-- 
Marcin Domanski
http://kabturek.info

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread b logica

There's not much to show. All I want to do is prepend '/membership/'
to all members routes.

This works fine:
Router::connect('/membership/members', array('controller' =>
'members', 'action' => 'index'));

MembersController:

var $paginate = array(
'url' => array('/membership/members'),
'limit' => 20,
'page' => 1,
'order' => array('Member.last_name' => 'ASC'),
'fields' => array(
'Member.id',
'Member.first_name',
'Member.last_name',
'Member.slug'
)
);

function index()
{
$this->Member->recursive = 0;
$this->set('members', $this->paginate());
}

view:

prev() . ' ' . $paginator->numbers() . ' ' .
$paginator->next(); ?>

The "next" link is created as /members/index/page:2

I've tried adding the URL to these methods in several ways, debugging
in Paginator, but nothing's worked. I don't kow if this is a
shortcoming of either Paginator or Route, or if I just haven't
uncovered the magic formula to pass.

On Thu, May 15, 2008 at 6:11 PM, Nicolás Andrade
<[EMAIL PROTECTED]> wrote:
> I would like to see each php code and the resulting HTML link, if possible.
>
> It might help us to help you.
>
>
>
>
>
> On Thu, May 15, 2008 at 6:36 PM, b logica <[EMAIL PROTECTED]> wrote:
>>
>> Speaking of generic, I'm wondering if Nicolás' bug is more of an admin
>> routing one or something specific to pagination/routing. IOW, I still
>> don't know if what I want to do has an existing solution or I need to
>> hack Router as well. For the moment, I'm rolling my own pagination but
>> I'd really prefer to use something built-in.
>>
>> On Thu, May 15, 2008 at 4:46 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>> > On Thu, May 15, 2008 at 4:32 PM, Nicolás Andrade
>> > <[EMAIL PROTECTED]> wrote:
>> >>
>> >>
>> >> To solve my issue, I've added the following lines:
>> >>
>> >> if(strpos($url['action'],
>> >> Configure::read('Routing.admin') .
>> >> '_') !== false){
>> >> $url['action'] =
>> >> str_replace(Configure::read('Routing.admin') . '_' , '',
>> >> $url['action']);
>> >> }
>> >>
>> >> in /cake/libs/router.php, line 749 aprox.
>> >
>> > Please file a ticket over at trac.cakephp.org about this, as it might
>> > be something that can be fixed in a more generic way.
>> >
>> > --
>> > Chris Hartjes
>> > Internet Loudmouth
>> > Motto for 2008: "Moving from herding elephants to handling snakes..."
>> > @TheKeyBoard: http://www.littlehart.net/atthekeyboard
>> >
>> > >
>> >
>>
>>
>
>
>
> --
> Nicolás Andrade
> www.nicoandra.com.ar
> www.treintaguita.com.ar
> >
>

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread Nicolás Andrade
I would like to see each php code and the resulting HTML link, if possible.

It might help us to help you.





On Thu, May 15, 2008 at 6:36 PM, b logica <[EMAIL PROTECTED]> wrote:

>
> Speaking of generic, I'm wondering if Nicolás' bug is more of an admin
> routing one or something specific to pagination/routing. IOW, I still
> don't know if what I want to do has an existing solution or I need to
> hack Router as well. For the moment, I'm rolling my own pagination but
> I'd really prefer to use something built-in.
>
> On Thu, May 15, 2008 at 4:46 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
> > On Thu, May 15, 2008 at 4:32 PM, Nicolás Andrade
> > <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> To solve my issue, I've added the following lines:
> >>
> >> if(strpos($url['action'],
> Configure::read('Routing.admin') .
> >> '_') !== false){
> >> $url['action'] =
> >> str_replace(Configure::read('Routing.admin') . '_' , '',
> $url['action']);
> >> }
> >>
> >> in /cake/libs/router.php, line 749 aprox.
> >
> > Please file a ticket over at trac.cakephp.org about this, as it might
> > be something that can be fixed in a more generic way.
> >
> > --
> > Chris Hartjes
> > Internet Loudmouth
> > Motto for 2008: "Moving from herding elephants to handling snakes..."
> > @TheKeyBoard: http://www.littlehart.net/atthekeyboard
> >
> > >
> >
>
> >
>


-- 
Nicolás Andrade
www.nicoandra.com.ar
www.treintaguita.com.ar

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread b logica

Speaking of generic, I'm wondering if Nicolás' bug is more of an admin
routing one or something specific to pagination/routing. IOW, I still
don't know if what I want to do has an existing solution or I need to
hack Router as well. For the moment, I'm rolling my own pagination but
I'd really prefer to use something built-in.

On Thu, May 15, 2008 at 4:46 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
> On Thu, May 15, 2008 at 4:32 PM, Nicolás Andrade
> <[EMAIL PROTECTED]> wrote:
>>
>>
>> To solve my issue, I've added the following lines:
>>
>> if(strpos($url['action'], Configure::read('Routing.admin') .
>> '_') !== false){
>> $url['action'] =
>> str_replace(Configure::read('Routing.admin') . '_' , '', $url['action']);
>> }
>>
>> in /cake/libs/router.php, line 749 aprox.
>
> Please file a ticket over at trac.cakephp.org about this, as it might
> be something that can be fixed in a more generic way.
>
> --
> Chris Hartjes
> Internet Loudmouth
> Motto for 2008: "Moving from herding elephants to handling snakes..."
> @TheKeyBoard: http://www.littlehart.net/atthekeyboard
>
> >
>

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread Chris Hartjes
On Thu, May 15, 2008 at 4:32 PM, Nicolás Andrade
<[EMAIL PROTECTED]> wrote:
>
>
> To solve my issue, I've added the following lines:
>
> if(strpos($url['action'], Configure::read('Routing.admin') .
> '_') !== false){
> $url['action'] =
> str_replace(Configure::read('Routing.admin') . '_' , '', $url['action']);
> }
>
> in /cake/libs/router.php, line 749 aprox.

Please file a ticket over at trac.cakephp.org about this, as it might
be something that can be fixed in a more generic way.

-- 
Chris Hartjes
Internet Loudmouth
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread Nicolás Andrade
To solve my issue, I've added the following lines:

if(strpos($url['action'], Configure::read('Routing.admin') .
'_') !== false){
$url['action'] =
str_replace(Configure::read('Routing.admin') . '_' , '', $url['action']);
}

in /cake/libs/router.php, line 749 aprox.


File goes like this:


if (empty($named) && empty($args) && (!isset($url['action'])
|| $url['action'] == 'index')) {
$url['action'] = null;
}

if(strpos($url['action'], Configure::read('Routing.admin') .
'_') !== false){
$url['action'] =
str_replace(Configure::read('Routing.admin') . '_' , '', $url['action']);
}

$urlOut = Set::filter(array($url['controller'],
$url['action']));

if (isset($url['plugin']) && $url['plugin'] !=
$url['controller']) {
array_unshift($urlOut, $url['plugin']);
}


If something's bad please send an advice; it's not fairly tested so please
be careful with this.




On Thu, May 15, 2008 at 4:55 PM, b logica <[EMAIL PROTECTED]> wrote:

>
> Yeah, I forgot to mention that I tried:
>
> $paginator->next('Next', array('url' =>array('/membership/members')));
>
> with similar result. This is really unfortunate :-/
>
> On Thu, May 15, 2008 at 3:30 PM, Nicolás Andrade
> <[EMAIL PROTECTED]> wrote:
> > I'm having a similar problem with paginator too.
> >
> > In view, I've :
> >
> > echo $paginator->prev('< Prev', array('url' => array('name' =>
> $SearchFor)),
> > null, array('class'=>'disabled'));
> >
> > I expect it to link to /admin/artists/page:1/name:"SEARCHSTRING"
> >
> >
> > but instead of this, it links to:
> >
> > /admin/artists/admin_index/page:1/name:"SEARCHSTRING"
> >
> >
> > So, it's writing full action name (with and without prefix).
> >
> >
> > Strange, uh?
> >
> > A Cake issue? Of course I'm working in admin section.
> >
> >
> >
> >
> >
> >
> > On Thu, May 15, 2008 at 3:26 PM, b logica <[EMAIL PROTECTED]> wrote:
> >>
> >> I'm having some difficulty figuring out how to make pagination links
> >> use the path I need. I have a model, Members, for which the index
> >> lists all members and requires pagination. However, the client insists
> >> on putting this in a directory named "membership",  the index page of
> >> which is actually other content. What would normally be static content
> >> is actually being served from the DB by a Content controller. So,
> >> /membership/ shows that content and I thought I would create a route:
> >>
> >> Router::connect('/membership/members', array('controller' =>
> >> 'members', 'action' => 'index'));
> >>
> >> and have the index method list the members. This works fine but the
> >> paginator creates links without the "/membership" part of the path. I
> >> tried:
> >>
> >> var $paginate = array(
> >>'url' => array('/membership/members'),
> >> ...
> >>
> >> and:
> >>
> >> var $paginate = array(
> >>'url' => array('/membership/members', array('controller' =>
> >> 'members', 'action' => 'index')),
> >> ...
> >>
> >> without any luck. Is there no way to get paginator to do this? If not,
> >> what's the use case for the 'url' param, then?
> >>
> >>
> >
> >
> >
> > --
> > Nicolás Andrade
> > www.nicoandra.com.ar
> > www.treintaguita.com.ar
> > >
> >
>
> >
>


-- 
Nicolás Andrade
www.nicoandra.com.ar
www.treintaguita.com.ar

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread b logica

Yeah, I forgot to mention that I tried:

$paginator->next('Next', array('url' =>array('/membership/members')));

with similar result. This is really unfortunate :-/

On Thu, May 15, 2008 at 3:30 PM, Nicolás Andrade
<[EMAIL PROTECTED]> wrote:
> I'm having a similar problem with paginator too.
>
> In view, I've :
>
> echo $paginator->prev('< Prev', array('url' => array('name' => $SearchFor)),
> null, array('class'=>'disabled'));
>
> I expect it to link to /admin/artists/page:1/name:"SEARCHSTRING"
>
>
> but instead of this, it links to:
>
> /admin/artists/admin_index/page:1/name:"SEARCHSTRING"
>
>
> So, it's writing full action name (with and without prefix).
>
>
> Strange, uh?
>
> A Cake issue? Of course I'm working in admin section.
>
>
>
>
>
>
> On Thu, May 15, 2008 at 3:26 PM, b logica <[EMAIL PROTECTED]> wrote:
>>
>> I'm having some difficulty figuring out how to make pagination links
>> use the path I need. I have a model, Members, for which the index
>> lists all members and requires pagination. However, the client insists
>> on putting this in a directory named "membership",  the index page of
>> which is actually other content. What would normally be static content
>> is actually being served from the DB by a Content controller. So,
>> /membership/ shows that content and I thought I would create a route:
>>
>> Router::connect('/membership/members', array('controller' =>
>> 'members', 'action' => 'index'));
>>
>> and have the index method list the members. This works fine but the
>> paginator creates links without the "/membership" part of the path. I
>> tried:
>>
>> var $paginate = array(
>>'url' => array('/membership/members'),
>> ...
>>
>> and:
>>
>> var $paginate = array(
>>'url' => array('/membership/members', array('controller' =>
>> 'members', 'action' => 'index')),
>> ...
>>
>> without any luck. Is there no way to get paginator to do this? If not,
>> what's the use case for the 'url' param, then?
>>
>>
>
>
>
> --
> Nicolás Andrade
> www.nicoandra.com.ar
> www.treintaguita.com.ar
> >
>

--~--~-~--~~~---~--~~
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: Paginator and subdirectory

2008-05-15 Thread Nicolás Andrade
I'm having a similar problem with paginator too.

In view, I've :

echo $paginator->prev('< Prev', array('url' => array('name' => $SearchFor)),
null, array('class'=>'disabled'));

I expect it to link to /admin/artists/page:1/name:"SEARCHSTRING"


but instead of this, it links to:

/admin/artists/admin_index/page:1/name:"SEARCHSTRING"


So, it's writing full action name (with and without prefix).


Strange, uh?

A Cake issue? Of course I'm working in admin section.






On Thu, May 15, 2008 at 3:26 PM, b logica <[EMAIL PROTECTED]> wrote:

>
> I'm having some difficulty figuring out how to make pagination links
> use the path I need. I have a model, Members, for which the index
> lists all members and requires pagination. However, the client insists
> on putting this in a directory named "membership",  the index page of
> which is actually other content. What would normally be static content
> is actually being served from the DB by a Content controller. So,
> /membership/ shows that content and I thought I would create a route:
>
> Router::connect('/membership/members', array('controller' =>
> 'members', 'action' => 'index'));
>
> and have the index method list the members. This works fine but the
> paginator creates links without the "/membership" part of the path. I
> tried:
>
> var $paginate = array(
>'url' => array('/membership/members'),
> ...
>
> and:
>
> var $paginate = array(
>'url' => array('/membership/members', array('controller' =>
> 'members', 'action' => 'index')),
> ...
>
> without any luck. Is there no way to get paginator to do this? If not,
> what's the use case for the 'url' param, then?
>
> >
>


-- 
Nicolás Andrade
www.nicoandra.com.ar
www.treintaguita.com.ar

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Paginator and subdirectory

2008-05-15 Thread b logica

I'm having some difficulty figuring out how to make pagination links
use the path I need. I have a model, Members, for which the index
lists all members and requires pagination. However, the client insists
on putting this in a directory named "membership",  the index page of
which is actually other content. What would normally be static content
is actually being served from the DB by a Content controller. So,
/membership/ shows that content and I thought I would create a route:

Router::connect('/membership/members', array('controller' =>
'members', 'action' => 'index'));

and have the index method list the members. This works fine but the
paginator creates links without the "/membership" part of the path. I
tried:

var $paginate = array(
'url' => array('/membership/members'),
...

and:

var $paginate = array(
'url' => array('/membership/members', array('controller' =>
'members', 'action' => 'index')),
...

without any luck. Is there no way to get paginator to do this? If not,
what's the use case for the 'url' param, then?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---