Re: Sort with random order

2010-03-19 Thread Onkel Judith
*push* :/

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 from this group, send email to 
cake-php+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Auth losting authentication with no reason

2010-03-18 Thread Onkel Judith
Same effect here
if you double-click a link you are also logged out. Maybe it's a
security feature?

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


Re: Problem with $confirmMessage to display a javascript confirm() dialog

2010-03-18 Thread Onkel Judith
Hey,

I think it should look like this:

"echo $html->link(  $html->image('erase.png', array('width' =>
'25px',
'alt' => 'Delete', 'title'=>'Delete')),
 
array(  'controller'=>'rollings',
 
'action'=>'delete',
 
$rolling['Rolling']['id']),
array(), 'Are
you sure you wish to delete this model?', false );"

The "false" at the end prevents the link()-function from escaping.

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


Sort with random order

2010-03-18 Thread Onkel Judith
Hey,

I want to sort a paginate()-result in a random order. It would be
simple, if all results should be random

var $paginate = array(
'limit' => 10,
'order' => 'RAND()'
);

But the default row should be the date and I want to generate a a
sorting link, so that the user can sort by random on his own choice.

sort("Random", 'RAND()')?>

Unfortunately it's not working. I think the model validates the second
parameter und checks if it's a rowname.

Is there a way to generate a link with random-sorting?

Regards,
Onkel Judith

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


Re: validates() doesn't validate

2009-07-23 Thread Onkel Judith

Oh, thank you so much :)

I looked for the error for hours
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



validates() doesn't validate

2009-07-23 Thread Onkel Judith

Hi,
I created a contact form with its own model. The model includes some
validation rules.
I'm calling validates() in the controller after setting up the model's
data. The problem is that validates() always returns true, even if I
don't write anything into the form.

Here's my code:

Controller:
Auth->autoRedirect = false;
if(isset($this->Auth)) {
$this->Auth->allow();
$this->Auth->authorize = "controller";
}
}

function index() {
if(!empty($this->data)) {
$this->Contact->set($this->data);
if($this->Contact->validates()) {
...
}
}
}
}
?>

Model:
 array(
'type' => 'string'
),
'email' => array (
'type' => 'string'
),
'message' => array(
'type' => 'text'
),
'receiver' => array(
'type' => 'string'
)
);

var $validate = array(
'name' => array('rule'=>'notempty', 'message'=>'Bitte einen
Namen angeben'),
'receiver' => array('rule'=>'notempty', 'message'=>'Bitte 
einen
Empfänger angeben'),
'email' => array('rule'=>'email', 'message'=>'Bitte eine 
gültige
E-Mail angeben'),
'message' => array('rule'=>'notempty', 'message'=>'Bitte 
eine
Nachricht angeben')
);
}
?>

View:
create('contact', array('url'=>array
('controller'=>'contact', 'action'=>'index')));
echo $form->input('receiver');
echo $form->input('name');
echo $form->input('email');
echo $form->input('message');
echo $form->end("Abschicken");
?>

Any ideas what's wrong? I'm really confused.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How to use 'group by' with paginate()?

2009-07-18 Thread Onkel Judith

Oh, after all I think this was a stupid question. :)
I just had to change the recursive-value to 1. Because of the hasMany
relation the comments are listed in a sub-array. The number of
comments was easy to find, simply use count() on this array.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: How to use 'group by' with paginate()?

2009-07-18 Thread Onkel Judith

On 16 Jul., 10:44, Miles J  wrote:
> Do you have a $paginate property in your controller? You should place
> the group within the model within the $paginate.

Sorry for the late answer. Yes, there's $paginate in the controller:

var $paginate = array(
'limit' => 10,
'order' => array('News.created' => 'desc')
);

Could you help me with the group by?

The result should be a table having all news-columns and a additional
column with the number of comments related to this news-entry.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



How to use 'group by' with paginate()?

2009-07-15 Thread Onkel Judith

Hi

I'm new to CakePHP and maybe it's a very stupid question. But I don't
hope so :)
My question is: How to use a group by clause with paginate()? Here's a
short description of my project:

Table 'news':
Id, title, ...

Table 'comments':
Id, news_id, ...

I want to query all news with the number of comments, which are
related to this news-entry.

After baking I got the following code:

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

After reading the API (http://api.cakephp.org/class/controller#method-
Controllerpaginate) I think, that I have to do this with some
additional constructions.
I thought of querying all number of comments with the related news-id:

SELECT news_id, count( * ) AS counter
FROM comments
GROUP BY news_id

This results in an easy-to-use table, which could be placed in an
array. Then I could access the count with the news_id as a key.

Is this a good idea in the world of CakePHP and how can I realize it?

Thanks a lot

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