Google Groups Home
Help | Sign in
Message from discussion Paginator and subdirectory
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
b logica  
View profile
 More options May 15, 6:42 pm
From: "b logica" <foo.log...@gmail.com>
Date: Thu, 15 May 2008 18:42:07 -0400
Local: Thurs, May 15 2008 6:42 pm
Subject: Re: Paginator and subdirectory
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:

<?= $paginator->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

<shosoieltiernodelage...@gmail.com> 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 <foo.log...@gmail.com> 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 <chart...@gmail.com> wrote:
>> > On Thu, May 15, 2008 at 4:32 PM, Nicolás Andrade
>> > <shosoieltiernodelage...@gmail.com> 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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google