Thursday, November 25, 2010

Re: pagination url options

There is common URL format in Cake: http://book.cakephp.org/view/1448/url
You can also check http://api.cakephp.org/class/router#method-Routerurl
for more params.

On Nov 25, 12:37 pm, Dmitry Shevchenko <dmitr...@gmail.com> wrote:
> Thank you Dr. Loboto
> This is really great fix. - all works perfectly.
>
> p.s. it is really sad that this feature not described in the docs....
>
> On Nov 24, 5:54 am, "Dr. Loboto" <drlob...@gmail.com> wrote:
>
>
>
>
>
>
>
> > $paginator->options(array('url' => array('?' => $this-
>
> > >data['Search']));
>
> > On 24 ноя, 09:31, Dmitry Shevchenko <dmitr...@gmail.com> wrote:
>
> > > I found a very bad solution
> > > 1. make convert from array to url manually
> > > 2. add this to parameters array
> > > 3. unset not flat array's in param
>
> > > f.e.
> > > $seeking_url = '';
> > >             if (!empty($this->data['Search']['seeking']))
> > >             {
> > >                 $seeking_url .= "seeking="; //make url to string
>
> > >                 foreach ($this->data['Search']['seeking'] as $field=>
> > > $value)
> > >                 {
> > >                     $seeking_url .= "&seeking[]=".$value; //make url
> > > to string
> > >                 }
> > >                 $this->data['Search']['see'] = $seeking_url; //add to
> > > params
>
> > >                unset($this->data['Search']['seeking']); // unset real
> > > array
>
> > >     }
>
> > > but this is VERY UGLY solution. Maybe someone knew better ??
>
> > > On Nov 23, 3:55 pm, Dmitry Shevchenko <dmitr...@gmail.com> wrote:
>
> > > > Hi.
> > > > I found a some error when using paginator-> options ( .. url ..)
>
> > > > for example this is my call for paginator in view.
> > > > $paginator->options  (array('url' => $this->data['Search'] ..
>
> > > > and if data['Search'] is flat array - all is good - it will create a
> > > > correct url
> > > > but if it contain a sub arrays like:
> > > > $url    =       array(
> > > >         "controller" => "profiles",
> > > >         "plugin" => null,
> > > >         "page" => 1,
> > > >         "search_type" => "advanced",
> > > >         "age_from" => "0",
> > > >         "age_to" => "0",
> > > >         "with_photo" => "0",
> > > >         "is_online" => "0",
> > > >         "seeking" => array(
> > > >         "5",
> > > >         "7"
> > > > ),
>
> > > > I'm getting a Array to string conversion [ROOT\cake\cake\libs
> > > > \router.php, line 952]
>
> > > > It seems cake doesn't convert sub arrays like
> > > > seeking=&seeking[]=1&seeking[]=2&seeking[]=4&seeking[]=7
>
> > > > Do anyone knew some workaround for this?
>
> > > > p.s. I'm using cake 1.2.6 and possibly found a bug

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: