Re: How to pass an array trough URL??

2010-04-14 Thread Alterego
This doesn't work for me in 1.3 RC3. Any ideas on how to pass an array
to passedArgs in URL in Cake 1.3?

Johannes

(Sorry if this message appeared twice, I can't see if it's been posted
already.)

On 29 mrt, 18:04, "toka...@gmail.com"  wrote:
> I have solved it. pretty simple.
>
> examples.com/:controller/:action/?
> names[]=John&names[]=Tomas&names[]=Susan
>
> then just call
> $this->params['url'] to get your array 'names'.
>
> PS: you can also do nested arrays like names[0]
> [email]=j...@example.com&names[1][email]=.
>
> Tomas
>
> On 29 bře, 11:59, "toka...@gmail.com"  wrote:
>
> > Hi, is there a chance to pass simple array via URL?
>
> >http://example.com/name:John/name:Tom/name:Susan
>
> > Then I should recieve back my array of names   array('John',
> > 'Tom', 'Susan');
>
> > Any idea how the URL should look like?
>
> > Thanks
> > Tomas

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

To unsubscribe, reply using "remove me" as the subject.


Re: How to pass an array trough URL??

2010-04-14 Thread Alterego
I have the same problem, but your trick doesn't work for me in 1.3
RC3..
$passedArgs is empty..

Any ideas on how to pass an array in the URL?

Johannes


On 29 mrt, 18:04, "toka...@gmail.com"  wrote:
> I have solved it. pretty simple.
>
> examples.com/:controller/:action/?
> names[]=John&names[]=Tomas&names[]=Susan
>
> then just call
> $this->params['url'] to get your array 'names'.
>
> PS: you can also do nested arrays like names[0]
> [email]=j...@example.com&names[1][email]=.
>
> Tomas
>
> On 29 bře, 11:59, "toka...@gmail.com"  wrote:
>
> > Hi, is there a chance to pass simple array via URL?
>
> >http://example.com/name:John/name:Tom/name:Susan
>
> > Then I should recieve back my array of names   array('John',
> > 'Tom', 'Susan');
>
> > Any idea how the URL should look like?
>
> > Thanks
> > Tomas

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

To unsubscribe, reply using "remove me" as the subject.


Re: Inluding a pseudo field in a Model and sort on it

2010-04-13 Thread Alterego
Thank you for your replies.

I use the new 1.3 virtual field now, and it works perfectly!

On 13 apr, 01:27, jacmoe  wrote:
> I had the same problem yesterday, and had to manually massage the data
> into a data array, but that was because I had (and still have) three
> computed fields.
> But I believe that you can use Teknoid's advice 
> here:http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-field...
> Override your models find function and your data should be good for
> pagination. :)
>
> If not, you just need to re-arrange the array yourself.
>
> On Apr 12, 5:23 pm, Alterego  wrote:
>
> > Hi there,
>
> > I have a small issue that kept me busy for a whole day now.
>
> > I want to sort on a psuedofield, so I use this code in the controller:
>
> > function index() {
> >                 $this->Contract->recursive = 0;
>
> >                 $this->paginate = array(
> >                   'fields' => array('*', 'COALESCE(price_month_action,
> > price_month_regular) AS price_month_least'),
> >                         'limit' => 500,
> >                         'order' => array('price_month_least' => 'asc'));
>
> >                 $this->set('contracts', $this->paginate());
> >         }
>
> > This works, but the 'price_month_least' value is outside of the
> > Contract array + sorting doesn't work when I pass the sorting
> > arguments in the URL like so: /contracts/index/sort:price_month_least/
>
> > I tried to add the pseudofield in the beforeFind in the Model, but
> > that didn't solve the problem. Could anybody help me out?
>
> > Thank you.

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

To unsubscribe, reply using "remove me" as the subject.


Inluding a pseudo field in a Model and sort on it

2010-04-12 Thread Alterego
Hi there,

I have a small issue that kept me busy for a whole day now.

I want to sort on a psuedofield, so I use this code in the controller:

function index() {
$this->Contract->recursive = 0;

$this->paginate = array(
  'fields' => array('*', 'COALESCE(price_month_action,
price_month_regular) AS price_month_least'),
'limit' => 500,
'order' => array('price_month_least' => 'asc'));

$this->set('contracts', $this->paginate());
}

This works, but the 'price_month_least' value is outside of the
Contract array + sorting doesn't work when I pass the sorting
arguments in the URL like so: /contracts/index/sort:price_month_least/

I tried to add the pseudofield in the beforeFind in the Model, but
that didn't solve the problem. Could anybody help me out?

Thank you.

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

To unsubscribe, reply using "remove me" as the subject.