Wednesday, December 31, 2008

Re: Controller members

On Wed, Dec 31, 2008 at 5:03 PM, Steven Wright <rhythmicdevil@gmail.com> wrote:
>
> Ok fair enough. So how does one use the $javascript->object() ?
>
> I want to pass an array to a javasrcipt variable.
>

For ajax actions, just echo a JSON object. There's no point in using
set() as that's only going to create a PHP variable for the view.

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

Re: Problem in model designing

For simplicity's sake I would keep them in the one table, and
dynamically change the $validate array in my beforeValidate method of
the model to suit.

I've never used this but it may help you:
http://bakery.cakephp.org/articles/view/conditinalvalidation-behavior

Cheers,
Adam

On Dec 26 2008, 11:40 pm, kaushik <kaushikwo...@gmail.com> wrote:
> I am going develop a system where there is two types of members.
> During registration or edit profile, there will be some common fields
> as well as some member type specific fields. Some of the common fields
> are mandatory, some are not. Same is true for member type specific
> fields. But both type of members will share same log in panel and
> other features. So I will like to store them in same table. But I am
> facing problem to create the model for it and write the validate code
> there.
> Anyone can give me any idea for that issue.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Problem in model designing

If I use three tables(one for common fields, one for uncommon fields
of type A, another for uncommon fields of type B), I have no prob but
how to make model or controller or view? Problem is that from a single
interface, I have to insert or edit data two different tables? Do you
can give some idea about that?


On Dec 26 2008, 6:50 pm, Steven Wright <rhythmicde...@gmail.com>
wrote:
> I would not store them in the same table. Store the common fields in one
> table and then use two other table to store the user type specific fields.
>
> Why do you want to store all the information in one table?
>
> -----Original Message-----
> From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
>
> Of kaushik
> Sent: Friday, December 26, 2008 8:40 AM
> To: CakePHP
> Subject: Problem in model designing
>
> I am going develop a system where there is two types of members.
> During registration or edit profile, there will be some common fields as
> well as some member type specific fields. Some of the common fields are
> mandatory, some are not. Same is true for member type specific fields. But
> both type of members will share same log in panel and other features. So I
> will like to store them in same table. But I am facing problem to create the
> model for it and write the validate code there.
> Anyone can give me any idea for that issue.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Validation errors for the wrong form

Hi all,
Apologies if this has been addressed before, but I've searched and
can't find a thing.

I have a register page, with a login element in the sidebar. The login
element is on every page in the sidebar. When I try register with
invalid data, the correct validation errors show for the register
form. However, the errors are also showing on the login form, even
though that hasn't been submitted. The login form is using jQuery Ajax
to submit.

Any ideas anyone?

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

Re: checkbox groups in cakephp 1.2

Ok, I think I'm getting closer but its still not working. here is
what I have. In the view, what should go where 'Ethnicity' currently
is? and is the saveAll() supposed to work in this case?


tables:
CREATE TABLE users
(
id int NOT NULL AUTO_INCREMENT,
about_me varchar(255),
PRIMARY KEY (id)
);

CREATE TABLE ethnicities_users(
id int NOT NULL AUTO_INCREMENT,
user_id int,
ethnicity_id int,
PRIMARY KEY (id)
);

CREATE TABLE ethnicities(
id int NOT NULL AUTO_INCREMENT,
ethnicityName varchar(255),
PRIMARY KEY (id)
);

models:

class User extends AppModel
{

var $name = 'User';

var $hasAndBelongsToMany = array ( 'Ethnicity' => array(
'className' => 'Ethnicity',
'joinTable' => 'ethnicities_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 'ethnicity_id'
)
);
}

class Ethnicity extends AppModel
{
var $name = 'Ethnicity';

var $hasAndBelongsToMany = array ( 'User' => array(
'className' => 'User',
'joinTable' => 'ethnicities_users',
'foreignKey' => 'ethnicity_id',
'associationForeignKey' => 'user_id'
)
);
}

controller:

function add() {
$this->log('in newuser_controller add()');
$this->User->create();
if(!empty($this->data)) {
//If the form data can be validated and saved...
if($this->User->saveAll($this->data)) {
$this->Session->setFlash("User Saved!");
}
}
}

view:
<? echo $form->create('User', array('action'=>'add')); ?>
<? echo $form->input('Ethnicity', array( 'type' => 'select',
'multiple' => 'checkbox' ),$ethnicities); ?>
<?php echo $form->end('Submit'); ?><br/>

On Dec 31, 3:17 pm, "Arthur Pemberton" <pem...@gmail.com> wrote:
> On Wed, Dec 31, 2008 at 1:54 PM, mike <mwu...@gmail.com> wrote:
>
> > thanks for the response.  thats not quite what I want.  Each user can
> > havemultipleethnicities, so its a many to many relationship.  In my
> > models, I have User hadMany UsersEthnicities, Ethnicity hasMany
> > UsersEthnicity and UsersEthnicity belongsTo User and Ethnicity.  Is
> > this correct?
>
> Are you following this:http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM?
>
> I don't think you have to do 'UsersEthnicities' explicity, unless
> you're doing some complex SELECT. For simple editing, defining the
> HABTM in the model should be enough.
>
> --
> Fedora 9 : sulphur is good for the skin
> (www.pembo13.com)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Reverse relations?

I could of sworn I tried that and it didn't work, I must have changed
the foreign_key. Anyways that worked.

Yeah I was also thinking in my system... is that a user is top level
and he has many different parts. A user is not necessarily part of a
country, but I guess ill have to do it that way.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

RE: Controller members

Ok fair enough. So how does one use the $javascript->object() ?

I want to pass an array to a javasrcipt variable.

Thanks.

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of Bernardo Vieira
Sent: Wednesday, December 31, 2008 3:58 PM
To: cake-php@googlegroups.com
Subject: Re: Controller members


It's not matter of inheritance, the problem is that helpers aren't meant to
be used in controllers. The $helpers array only tells the dispatcher which
helpers to load when rendering the view. Try this:
controllers/ajaxtests_controller

function test() {
$this->set('myvar',$arr);
}

views/ajaxtests/test.ctp
echo $javascript->object($myvar);

rhythmicdevil@gmail.com wrote:
> Confused about inheritance here.
>
> Here is the helpers var from Cake's controller file.
> var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
>
> AppController extends this so I think that the helpers should be
> available there.
>
> My controller AjaxtestsController extends Appcontroller and so they
> should also be available there
>
> However when I do the following:
> $this->set('myvar', $this->javascript->object($arr)); or
> $this->set('myvar', $javascript->object($arr));
>
> I get the following error:
>
> Notice (8): Undefined property: AjaxtestsController::$javascript [APP
> \controllers\ajaxtests_controller.php, line 26]
>
> Code | Context
>
> $arr = array(
> "item 1",
> "item 2"
> )
>
>
> //debug($this);
> $this->set('myvar', $this->javascript->object($arr));
>
> AjaxtestsController::edit() - APP\controllers
> \ajaxtests_controller.php, line 26
> Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 245
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 211 [main] -
> APP\webroot\index.php, line 88
>
>
> Fatal error: Call to a member function object() on a non-object in C:
> \htdocs\caketest\app\controllers\ajaxtests_controller.php on line 26
>
>
>
> CODE POSTED BELOW
>
> <?php
>
> class AjaxtestsController extends AppController {
>
> var $helpers = array('Javascript');
>
>
> function index()
> {
> $this->pageTitle = 'Index Page';
> }
>
> function view()
> {
> $this->pageTitle = 'View Page';
> }
>
> function edit()
> {
> $this->pageTitle = 'Edit Page';
>
> $arr = array('item 1', 'item 2');
>
> //debug($this);
> $this->set('myvar', $this->javascript->object($arr));
> }
>
> }
>
> ?>
>
> >
>
>


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

Re: Controller members

It's not matter of inheritance, the problem is that helpers aren't meant
to be used in controllers. The $helpers array only tells the dispatcher
which helpers to load when rendering the view. Try this:
controllers/ajaxtests_controller

function test() {
$this->set('myvar',$arr);
}

views/ajaxtests/test.ctp
echo $javascript->object($myvar);

rhythmicdevil@gmail.com wrote:
> Confused about inheritance here.
>
> Here is the helpers var from Cake's controller file.
> var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');
>
> AppController extends this so I think that the helpers should be
> available there.
>
> My controller AjaxtestsController extends Appcontroller and so they
> should also be available there
>
> However when I do the following:
> $this->set('myvar', $this->javascript->object($arr));
> or
> $this->set('myvar', $javascript->object($arr));
>
> I get the following error:
>
> Notice (8): Undefined property: AjaxtestsController::$javascript [APP
> \controllers\ajaxtests_controller.php, line 26]
>
> Code | Context
>
> $arr = array(
> "item 1",
> "item 2"
> )
>
>
> //debug($this);
> $this->set('myvar', $this->javascript->object($arr));
>
> AjaxtestsController::edit() - APP\controllers
> \ajaxtests_controller.php, line 26
> Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
> Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 245
> Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 211
> [main] - APP\webroot\index.php, line 88
>
>
> Fatal error: Call to a member function object() on a non-object in C:
> \htdocs\caketest\app\controllers\ajaxtests_controller.php on line 26
>
>
>
> CODE POSTED BELOW
>
> <?php
>
> class AjaxtestsController extends AppController
> {
>
> var $helpers = array('Javascript');
>
>
> function index()
> {
> $this->pageTitle = 'Index Page';
> }
>
> function view()
> {
> $this->pageTitle = 'View Page';
> }
>
> function edit()
> {
> $this->pageTitle = 'Edit Page';
>
> $arr = array('item 1', 'item 2');
>
> //debug($this);
> $this->set('myvar', $this->javascript->object($arr));
> }
>
> }
>
> ?>
>
> >
>
>


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

Controller members

Confused about inheritance here.

Here is the helpers var from Cake's controller file.
var $helpers = array('Html', 'Form', 'Javascript', 'Ajax');

AppController extends this so I think that the helpers should be
available there.

My controller AjaxtestsController extends Appcontroller and so they
should also be available there

However when I do the following:
$this->set('myvar', $this->javascript->object($arr));
or
$this->set('myvar', $javascript->object($arr));

I get the following error:

Notice (8): Undefined property: AjaxtestsController::$javascript [APP
\controllers\ajaxtests_controller.php, line 26]

Code | Context

$arr = array(
"item 1",
"item 2"
)


//debug($this);
$this->set('myvar', $this->javascript->object($arr));

AjaxtestsController::edit() - APP\controllers
\ajaxtests_controller.php, line 26
Object::dispatchMethod() - CORE\cake\libs\object.php, line 115
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 245
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 211
[main] - APP\webroot\index.php, line 88


Fatal error: Call to a member function object() on a non-object in C:
\htdocs\caketest\app\controllers\ajaxtests_controller.php on line 26

CODE POSTED BELOW

<?php

class AjaxtestsController extends AppController
{

var $helpers = array('Javascript');


function index()
{
$this->pageTitle = 'Index Page';
}

function view()
{
$this->pageTitle = 'View Page';
}

function edit()
{
$this->pageTitle = 'Edit Page';

$arr = array('item 1', 'item 2');

//debug($this);
$this->set('myvar', $this->javascript->object($arr));
}

}

?>

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

Re: checkbox groups in cakephp 1.2

On Wed, Dec 31, 2008 at 1:54 PM, mike <mwu153@gmail.com> wrote:
>
> thanks for the response. thats not quite what I want. Each user can
> have multiple ethnicities, so its a many to many relationship. In my
> models, I have User hadMany UsersEthnicities, Ethnicity hasMany
> UsersEthnicity and UsersEthnicity belongsTo User and Ethnicity. Is
> this correct?


Are you following this:
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM ?

I don't think you have to do 'UsersEthnicities' explicity, unless
you're doing some complex SELECT. For simple editing, defining the
HABTM in the model should be enough.

--
Fedora 9 : sulphur is good for the skin
( www.pembo13.com )

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

Re: checkbox groups in cakephp 1.2

thanks for the response. thats not quite what I want. Each user can
have multiple ethnicities, so its a many to many relationship. In my
models, I have User hadMany UsersEthnicities, Ethnicity hasMany
UsersEthnicity and UsersEthnicity belongsTo User and Ethnicity. Is
this correct?

I agree with you about the sigular ids but thats the least of my
concerns right now.

On Dec 31, 1:57 am, brian <bally.z...@gmail.com> wrote:
> On Wed, Dec 31, 2008 at 12:53 AM, mike <mwu...@gmail.com> wrote:
>
> > but I need something like this right?
> >            [data] => Array
> >                (
> >                    [UsersEthnicity] => Array
> >                        (
> >                            [ethnicity_id] => 1
> >                            [users_id] => 14,
>
> >                            [ethnicity_id] => 2
> >                            [users_id] => 14
> >                        )
>
> >                    [User] => Array
> >                        (
> >                            [age] => 21
> >                            [about_me] => adfsadfs
> >                        )
>
> >                )
>
> You can't havemultipleidentical keys. But I'd think, if I'm reading
> this correctly, that you'd want Ethnicity, not the join table.
>
> [data] => Array
> (
>         [Ethnicity] => Array
>         (
>                 [0] => Array
>                 (
>                         [id] => 1
>                 ),
>                 [1] => Array
>                 (
>                         [id] => 2
>                 )
>         ),
>         [User] => Array
>         (
>                 [age] => 21
>                 [about_me] => adfsadfs
>         )
> )
>
> You're providing a choice of several ethnicities, not relationships
> between ethnicities and users, so your checkboxes should reflect
> ethnicities. If the associations are set up properly, Cake will deal
> with the join table. How do you have the model relations set up?
>
> And you'll need to include User.id, as well, I suppose.
>
> I don't that it's related (heh) but you should use the singular form
> with foreign key names, ie user_id. The idea is that, while the table
> contains many users, this user_id is unique.- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: what's wrong with my route?

On Wed, Dec 31, 2008 at 2:49 AM, Adam Royle <adam@sleekgeek.com.au> wrote:
>
> I don't usually care about routes for my admin controllers since no
> one except administrators see them, so if it was me I wouldn't worry
> about it.

It's not just the admin routes I'm having problems with. Perhaps that
wasn't the best example. In any case, I've seen several examples where
the path does not conform to Cake's "/controller/action' paradigm and
a route is created to point to the correct controller. My problem is
that this appears to only work some of the time. And I cannot figure
out why it works when it does.

> However you could probably simplify your routes:
>
> Router::connect('/admin/islandnews/:action/*', array('controller' =>
> 'newsletters', 'admin' => true));

I've purposely not made them simple, as that actually makes things
less convenient. I'm fine with spelling out a few extra routes. I need
to be able to use, eg.
/islandnews/2008-10

... among other things. That particular one works in some situations,
other times, not so much.

Basically, my question is, what's up with this reverse routing I keep
reading about? Either it doesn't work as advertised, or I'm doing
something wrong (and I expect it's the latter).

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

Re: How to display total no of entries from database

> I guess you mean your main table:
>
> Inefficient method:
>
> In your controller:
>
> $total_num_rows = count($this->Model->find('all'));
>
> More efficient method, also works if you would like to do it on several tables.
>
> $num = $this->query("SELECT COUNT(*) FROM table_a, table_b");

ermm

most efficient method:

$total_num_rows = $this->Model->find('count');

happy new year bakers!

j


--

jon bennett
w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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

Re: Datetime Concatenate in Controller

On Wed, Dec 31, 2008 at 11:15 AM, cguyer <colbyguyer@gmail.com> wrote:
>
> I need to concatenate a datetime field from a view in a controller
> before save (.i.e $this->data['Model']['datetime'][year],$this->data
> ['Model']['datetime'][month], etc.). I believe I need to use $date=
> $this->Model->set(??) which calls deconstruct but from the api im not
> able to figure out the syntax to get it to work. Any help?

This doesn't work?
$this->data['Model']['whatever'] = ...

If you're not too concerned about relying on javascript, there are a
lot of calendar widgets out there that'll format a date string into a
single text field. The jQuery.ui.Calendar widget, for instance.

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

Captcha Component Causes Auth Not To Work

I've just tried to implement the Captcha Component that I found at
http://bakery.cakephp.org/articles/view/captcha-component-with-phpcaptcha
and I noticed that when I did this, it caused my auth component to go
crazy.

When I log in, Auth will show that I am logged in but only when I am
on the users controller. When I go to any other controller it says
that I am not logged in. Has any one else experienced this with the
Auth Component?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Datetime Concatenate in Controller

I need to concatenate a datetime field from a view in a controller
before save (.i.e $this->data['Model']['datetime'][year],$this->data
['Model']['datetime'][month], etc.). I believe I need to use $date=
$this->Model->set(??) which calls deconstruct but from the api im not
able to figure out the syntax to get it to work. Any help?

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

Re: form action url

$form->create('User', array
('controller'=>'users','action'=>'login'));

On Dec 30, 1:23 pm, jejk <jerome.ku...@gmail.com> wrote:
> I guess it s  a trouble with $base in dispatcher.php but I don't see
> how to tune that.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Email component — problems sending to same domain

smtp should be the default. It is the de facto standard for internet
transfer of email (simple mail transfer protocol)

mail is a 'nix based system of mails that are usually handled
internally or within a lan. I don't think that switching to mail
would help as the email would never reach your mail client. it would
just sit in the mail file waiting for you to login to the server.

This sounds like something you'll need to adress the host on.

Just curious what host are you using?

On Dec 30, 11:08 am, RyOnLife <ryan.mckillen@gmail.com> wrote:
> Hello, I am using the Email component and have the 'to' address set like
> this:
>
> $this->Email->to = 'me@mydomain.com';
>
> If mydomain.com is a domain hosted on my server, the email never arrives,
> but it works just fine when I change to:
>
> $this->Email->to = 'me@gmail.com';
>
> I assume this is a server setup issue—and not a Cake one—so I plan to talk
> to my host. Looking at the email.php component in the Cake core, seems that
> $this->delivery can either be 'smtp' or 'mail'. Is smtp the default? If the
> delivery method is 'mail', what mail sending service does that refer to?
>
> Thanks!
> --
> View this message in context:http://n2.nabble.com/Email-component-%E2%80%94%C2%A0problems-sending-...
> Sent from the CakePHP mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: difference mit plural with windows und linux

Controllers are plural so therefore needs to be named as follows ....

var $name = 'Schools';
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Is it possible to use helper in model?

Your missing the purpose of helpers.

They are meant to manipulate data as it is presented to users within a
view. (show nice dates, currency, trees, etc.)

Within a model you should just handle the data in its current form and
validate against that.

What would you use the number helper for in validation?

On Dec 30, 5:01 am, Hipnotik <Pork...@gmail.com> wrote:
> Hi
> Is it possible to use helper (in example number helper) in model?
> I would like to use it in example in beforeValidate method.
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Reverse relations?

> User belongsTo Country?

Yip .. the rule of thumb is that the table containing the foreign key
belongsTo the other table.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Problem Cake php

Ugh..

That's normal debug data. Set debug to 0 in config/core.php to turn
this off.

On Dec 31, 4:29 am, garza2002 <puc...@gmail.com> wrote:
> I have CakePHP v 1.0.0.2363. It is working fine in my actually server.
> But i want to transfer to another server. In this new server with the
> same configuration i obtain this error when i make a consult to the
> database through a controller.
>
> 2 queries took 1 ms Nr Query Error Affected Num. rows Took (ms)
> 1 DESC `sections`  14 14 1
> 2 SELECT `Section`.`id`, `Section`.`name`, `Section`.`parent_id`,
> `Section`.`title`, `Section`.`content`, `Section`.`description`,
> `Section`.`url`, `Section`.`controller`, `Section`.`order`,
> `Section`.`hits`, `Section`.`accesskey`, `Section`.`enabled`,
> `Section`.`admin`, `Section`.`static` FROM `sections` AS `Section`
> WHERE (`Section`.`url` = 'n1302-felices-fiestas') LIMIT 1
>
> I hope you can help me.
>
> Thanks.

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

Re: Reverse relations?

User belongsTo Country?

gearvOsh wrote:
> I know how to do relations for foreign keys, but I cannot figure out
> how to do this.
>
> In my users table, I have a column called state_id and country_id. I
> tried a hasOne country but that does not work. It looks for a user_id
> on the Country table that matches the user id, I need it the other way
> around. I need the country_id on the user table to match the id on the
> country table. How would I go about this?
> >
>
>


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

DbAcl::allow() - Invalid node

Hi,

I have an ACO object with alias "users/apanel_list" and a "admin" ARO
object in the DB.

When I issue $this->Acl->allow("admin", "users/apanel_list") I get the
following error -
DbAcl::allow() - Invalid node [CORE\cake\libs\controller\components
\acl.php, line 325]
The issue seem to be coming from ACO side.

I debugged through the code and the offending line was $obj['Aco'] =
$this->Aco->node($aco); in the getAclLink() function of the acl.php
core component file.

Any help would be appreciated.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

difference mit plural with windows und linux

Hello,

I have a problem with with cakephp under linux (centos 5.2) with the
naming conventions (plural). The name of my table is "schools".
So I thouhgt the name of my controller is: "schools_controller" and
the content of this file sould be something like :

<?php
class SchoolsController extends AppController {

var $name = 'School';
var $scaffold;
}
?>

But this doesn't work under my centos 5.2 (php 5.1.6 and php 5.2.6)
installation. I have to use "school_controller" and "class
SchoolController extends AppController".

Everything works like it should on my local xampp development machine
running under windows with php-5.2.8.

Does anyone have an idea, what could cause this strange behavior?

I'm using the same version of cakephp (1.2.0.7962) on both sides.

Best regards,
Wilfredo


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

Calling a (empty!) model-method causes SQL Error: 1064

Hi,

when I call a method of a model out of a controller, I get the
following sql-exception:

EXCEPTION ------------------------------------->

Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'doTest' at line 1 [CORE/cake/libs/model/
datasources/dbo_source.php, line 514]

Code | Context

$sql = "doTest"
$error = "1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'doTest' at line 1"
$out = null

$out = null;
if ($error) {
trigger_error("<span style = \"color:Red;text-
align:left\"><b>SQL Error:</b> {$this->error}</span>",
E_USER_WARNING);

DboSource::showQuery() - CORE/cake/libs/model/datasources/
dbo_source.php, line 514
DboSource::execute() - CORE/cake/libs/model/datasources/
dbo_source.php, line 201
DboSource::fetchAll() - CORE/cake/libs/model/datasources/
dbo_source.php, line 337
DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
line 298
Model::call__() - CORE/cake/libs/model/model.php, line 436
Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 52
AppModel::doTest() - [internal], line ??
StartController::index() - APP/controllers/start_controller.php, line
8
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 245
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 211
[main] - APP/webroot/index.php, line 88

Query: doTest

<------------------------------------- EXCEPTION

CODE -------------------------------->

class StartController extends AppController {
var $name = 'Start';
var $uses = array('Abc');

function index() {
// call that causes the exception
$this->Abc->doTest();
}
}

class Abc extends AppModel {
// ** ORM **
var $name = 'Abc';
var $table = 'abc';
var $displayField = 'titel';

// ** Methods **
function doTest() {
return null;
}
}

<-------------------------------- CODE

I am using the latest version (1.2 / nightlybuild 31.12.2008).


Any ideas?

Thanks.

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

Problems with HABTM

Hello everyone,
we have a problem with HABTM when we mix the "with" property with the
"joinTable" property.
We need to define the "joinTable" property, because our naming
convention is a little tricky and we want to simplify the relational
model name by defining the "with" property.
The problem is that when we use the "with" property, the joinTable
property get reseted to the cake naming convention (based on the value
of "with").
We didn't have this problem with cake 1.2RC3, it appeared when we
updated to 1.2 FINAL.
Is this a desirable behavior? or is it a bug?

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

Re: problem with password using AUTH

Well, you can change your logic and view. Change the view to NOT put
in the password value. During submission, if both the fields are
empty, ignore changing password else if both the fields are same, then
hash THAT string and use it as password. Simple.

On Dec 31, 3:45 pm, vikas <vikas...@gmail.com> wrote:
> hi..
> I used password field to store a password. I used the Auth component
> as it will automatically hash the password field.
>
> Now problem is when user edit his information, in password field the
> it shown as hash string(for example like "*****************").
>
> so this means the original password is hashed that is ok.but if user
> doesnot change the password during editing his information the
> password string is again hashed by Auth component and it is
> changed......
>
> so i want to retrive original password as a password text when user
> edit his information insted of that long hashed string. so when user
> not changed his password then string remains same and not
> overhashed...
>
> plz give some solution...

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

problem with password using AUTH

hi..
I used password field to store a password. I used the Auth component
as it will automatically hash the password field.

Now problem is when user edit his information, in password field the
it shown as hash string(for example like "*****************").

so this means the original password is hashed that is ok.but if user
doesnot change the password during editing his information the
password string is again hashed by Auth component and it is
changed......

so i want to retrive original password as a password text when user
edit his information insted of that long hashed string. so when user
not changed his password then string remains same and not
overhashed...

plz give some solution...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Conditional find on recursive belongsTo association

Bump ... really need some help with this!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Problem with auth component

if I understood the thread opener he wants to have an automagical
redirect to the login page after x min of inactivity by the user where
x is the SessionTimeout.
If you want that, I do not think CakePHP does it. Typo3 for instance
does that (and it is very annoying being a developer to have that
feature enabled because it popups windows all over the place).

How you could do it manually:
- Set / Refresh a specific cookie everytime the user does an action
- Have a Javascript/Ajax method that starts counting down after a page
was loaded until SessionTimeout should be reached. Do an Ajax call to
see if the session is still available. The user could have navigated
on other tabs tough, there he might have written the cookie to a newer
date. Fetch that cookie to your js and start counting again.

Do not forget: this relys on javascript that can do ajax calls
(xmlhttprequest) and cookies being enabled on the useragent side.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Problem Cake php

I have CakePHP v 1.0.0.2363. It is working fine in my actually server.
But i want to transfer to another server. In this new server with the
same configuration i obtain this error when i make a consult to the
database through a controller.

2 queries took 1 ms Nr Query Error Affected Num. rows Took (ms)
1 DESC `sections` 14 14 1
2 SELECT `Section`.`id`, `Section`.`name`, `Section`.`parent_id`,
`Section`.`title`, `Section`.`content`, `Section`.`description`,
`Section`.`url`, `Section`.`controller`, `Section`.`order`,
`Section`.`hits`, `Section`.`accesskey`, `Section`.`enabled`,
`Section`.`admin`, `Section`.`static` FROM `sections` AS `Section`
WHERE (`Section`.`url` = 'n1302-felices-fiestas') LIMIT 1

I hope you can help me.

Thanks.

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

Reverse relations?

I know how to do relations for foreign keys, but I cannot figure out
how to do this.

In my users table, I have a column called state_id and country_id. I
tried a hasOne country but that does not work. It looks for a user_id
on the Country table that matches the user id, I need it the other way
around. I need the country_id on the user table to match the id on the
country table. How would I go about this?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: How to find total enteries from database

http://book.cakephp.org/view/490/counterCache-Cache-your-count

On Dec 30, 5:57 pm, mona <poojapinj...@gmail.com> wrote:
> I wan't to display total enteries from database and i have one link on
> database when user enter new entry it will update the count how to do
> this
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Tuesday, December 30, 2008

Re: what's wrong with my route?

I don't usually care about routes for my admin controllers since no
one except administrators see them, so if it was me I wouldn't worry
about it.

However you could probably simplify your routes:

Router::connect('/admin/islandnews/:action/*', array('controller' =>
'newsletters', 'admin' => true));

Hope that helps.

Cheers,
Adam

On Dec 31, 9:57 am, brian <bally.z...@gmail.com> wrote:
> using 1.2.0.7962
>
> The model is Newsletter but I'd like to keep the legacy path,
> "islandnews". Some of the routes are working but others are not. For
> instance, this works:
> Router::connect('/admin/islandnews',
>         array('controller' => 'newsletters', 'action' => 'index', 'admin' => true)
> );
>
> However, in that view, I set up some links using the array notation:
> $edit_link = $html->link(
>         'edit',
>         array(
>                 'controller' => 'newsletters',
>                 'action' => 'edit',
>                 $newsletter['Newsletter']['id']
>         ),
>         array('title' => 'edit this edition')
> );
>
> Now, from what I understand, the fact that I have the following route set up:
> Router::connect('/admin/islandnews/edit/:id',
>         array('controller' => 'newsletters', 'action' => 'edit', 'admin' => true),
>         array(
>                 'id' => '[0-9]?',
>                 'pass' => array('id')
>         )
> );
>
> ... should cause Cake to create this URL:http://my.domain/admin/islandnews/edit/29
>
> Instead, I get:http://my.domain/admin/newsletters/edit/29
>
> If, in the view, I give "islandnews" for the controller, the link  is
> good, but the route still is not recognised.
>
> Strangely, in my admin_add() action, I have the following:
>
> if ($this->Newsletter->save($this->data))
> {
>         $this->flash('The newsletter has been created', array('action' => 'edit'));
>
> ... which redirects me to /admin/newsletters/edit (again, the route is
> ignored) where I have:
>
> $form->create('Newsletter', array('action' => 'edit'))
>
> Now, suddenly the route is recognised and I get a form with
> action="/admin/islandnews/edit/29"
>
> However, the route fails when the form is posted. So, how/why did the
> route get written that way? What the heck am I doing wrong here?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: checkbox groups in cakephp 1.2

On Wed, Dec 31, 2008 at 12:53 AM, mike <mwu153@gmail.com> wrote:
>
> but I need something like this right?
> [data] => Array
> (
> [UsersEthnicity] => Array
> (
> [ethnicity_id] => 1
> [users_id] => 14,
>
>
> [ethnicity_id] => 2
> [users_id] => 14
> )
>
>
> [User] => Array
> (
> [age] => 21
> [about_me] => adfsadfs
> )
>
>
> )

You can't have multiple identical keys. But I'd think, if I'm reading
this correctly, that you'd want Ethnicity, not the join table.

[data] => Array
(
[Ethnicity] => Array
(
[0] => Array
(
[id] => 1
),
[1] => Array
(
[id] => 2
)
),
[User] => Array
(
[age] => 21
[about_me] => adfsadfs
)
)

You're providing a choice of several ethnicities, not relationships
between ethnicities and users, so your checkboxes should reflect
ethnicities. If the associations are set up properly, Cake will deal
with the join table. How do you have the model relations set up?

And you'll need to include User.id, as well, I suppose.

I don't that it's related (heh) but you should use the singular form
with foreign key names, ie user_id. The idea is that, while the table
contains many users, this user_id is unique.

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

Re: checkbox groups in cakephp 1.2

ok here is my current issue:

here is the controller dump:
[data] => Array
(
[UsersEthnicity] => Array
(
[ethnicity_id] => Array
(
[0] => 1
[1] => 2
)


[users_id] => 14
)


[User] => Array
(
[age] => 21
[about_me] => adfsadfs
)


)


but I need something like this right?
[data] => Array
(
[UsersEthnicity] => Array
(
[ethnicity_id] => 1
[users_id] => 14,


[ethnicity_id] => 2
[users_id] => 14
)


[User] => Array
(
[age] => 21
[about_me] => adfsadfs
)


)


here's the controller function:
function add() {
$this->log('in newuser_controller add()');
$this->User->create();
if(!empty($this->data)) {
$this->log($this->data);
$this->log('test1');
//If the form data can be validated and
saved...
if($this->User->save($this->data)) {
$this->data['UsersEthnicity']['users_id'] =
$this->User->id;
$this->UsersEthnicity->save($this->data);
$this->log('test2');
//Set a session flash message and redirect.
$this->Session->setFlash("User
Saved!");
//$this->redirect('newuser/add');
}
}
}


view:
<? echo $form->input('UsersEthnicity.ethnicity_id', array( 'type' =>
'select', 'multiple' => 'checkbox' ),$ethnicities); ?>

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

Re: checkbox groups in cakephp 1.2

On Tue, Dec 30, 2008 at 9:19 PM, mike <mwu153@gmail.com> wrote:
> can someone help me with this please? the documentation is not good
> enough for dumbasses like me. thanks.


You'll have to remind us what you are trying to do.


--
Fedora 9 : sulphur is good for the skin
( www.pembo13.com )

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

Re: show / hide with ajax

You mean an accordion?

http://docs.jquery.com/UI/Accordion
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: checkbox groups in cakephp 1.2

can someone help me with this please? the documentation is not good
enough for dumbasses like me. thanks.

On Dec 29, 10:55 pm, mike <mwu...@gmail.com> wrote:
> thanks, thats what I was looking for.  However, I'm still having
> trouble getting the save to work properly.
>
> here is the controller dump:
>             [data] => Array
>                 (
>                     [UsersEthnicity] => Array
>                         (
>                             [ethnicity_id] => Array
>                                 (
>                                     [0] => 1
>                                     [1] => 2
>                                 )
>
>                             [users_id] => 14
>                         )
>
>                     [User] => Array
>                         (
>                             [age] => 21
>                             [about_me] => adfsadfs
>                         )
>
>                 )
>
> but I need something like this right?
>             [data] => Array
>                 (
>                     [UsersEthnicity] => Array
>                         (
>                             [ethnicity_id] => 1
>                             [users_id] => 14,
>
>                             [ethnicity_id] => 2
>                             [users_id] => 14
>                         )
>
>                     [User] => Array
>                         (
>                             [age] => 21
>                             [about_me] => adfsadfs
>                         )
>
>                 )
>
> here's the controller function:
>         function add() {
>                 $this->log('in newuser_controller add()');
>                 $this->User->create();
>                 if(!empty($this->data)) {
>                         $this->log($this->data);
>                         $this->log('test1');
>                         //If the form data can be validated and saved...
>                         if($this->User->save($this->data)) {
>                         $this->data['UsersEthnicity']['users_id'] = $this->User->id;
>                         $this->UsersEthnicity->save($this->data);
>                         $this->log('test2');
>                         //Set a session flash message and redirect.
>                                 $this->Session->setFlash("User Saved!");
>                                 //$this->redirect('newuser/add');
>                         }
>                 }
>         }
>
> view:
> <? echo $form->input('UsersEthnicity.ethnicity_id', array( 'type' =>
> 'select', 'multiple' => 'checkbox' ),$ethnicities); ?>
>
> On Dec 27, 2:18 pm, "Arthur Pemberton" <pem...@gmail.com> wrote:
>
>
>
> > On Sat, Dec 27, 2008 at 1:54 AM, mike <mwu...@gmail.com> wrote:
>
> > > I saw a helper class for this for 1.1, but nothing for 1.2.
>
> > > Is their an example of acheckboxgroup that maps to the same database
> > > field?  for example, onecheckboxmaps to a value of 1, another maps
> > > to a value of 2.
>
> >http://book.cakephp.org/view/193/options-multiple
>
> > --
> > Fedora 9 : sulphur is good for the skin
> > (www.pembo13.com)- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

show / hide with ajax

I am hoping someone can give me some ideas on the best way to set this
up.

I have a set of data that lists out client information row by row.
When a user clicks on the row, I want it to show a set of information
about that client (already have this part working with ajax). I am
not sure the best way to setup the div's so that 1) it shows directly
below the initial row of client data and 2) it collapses when another
client is clicked.

I hope this makes sense!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

what's wrong with my route?

using 1.2.0.7962

The model is Newsletter but I'd like to keep the legacy path,
"islandnews". Some of the routes are working but others are not. For
instance, this works:
Router::connect('/admin/islandnews',
array('controller' => 'newsletters', 'action' => 'index', 'admin' => true)
);

However, in that view, I set up some links using the array notation:
$edit_link = $html->link(
'edit',
array(
'controller' => 'newsletters',
'action' => 'edit',
$newsletter['Newsletter']['id']
),
array('title' => 'edit this edition')
);

Now, from what I understand, the fact that I have the following route set up:
Router::connect('/admin/islandnews/edit/:id',
array('controller' => 'newsletters', 'action' => 'edit', 'admin' => true),
array(
'id' => '[0-9]?',
'pass' => array('id')
)
);

... should cause Cake to create this URL:
http://my.domain/admin/islandnews/edit/29

Instead, I get:
http://my.domain/admin/newsletters/edit/29

If, in the view, I give "islandnews" for the controller, the link is
good, but the route still is not recognised.

Strangely, in my admin_add() action, I have the following:

if ($this->Newsletter->save($this->data))
{
$this->flash('The newsletter has been created', array('action' => 'edit'));

... which redirects me to /admin/newsletters/edit (again, the route is
ignored) where I have:

$form->create('Newsletter', array('action' => 'edit'))

Now, suddenly the route is recognised and I get a form with
action="/admin/islandnews/edit/29"

However, the route fails when the form is posted. So, how/why did the
route get written that way? What the heck am I doing wrong here?

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

Re: Order associated data

That's how I would have done it. Maybe I am imagining things but I'm
sure that worked in the past. Maybe a good chance to dig through the
core and submit an enhancement on trac.

Cheers,
Adam

On Dec 31, 8:13 am, Daniel <theworldof...@gmail.com> wrote:
> Hi, thank you for the advice - the first one works fine, but the
> second one doesn't.
>
> I've added it to the top of the Product model, just below the $name
> variable, like so:
>
> var $name = 'Product';
> var $order = 'Product.title ASC';
>
> Any idea?
>
> On Dec 30, 10:04 pm, Adam Royle <a...@sleekgeek.com.au> wrote:
>
> > Yes, you've got the categories/products thing set up as I would do it.
>
> > With ordering, you can do it both ways:
>
> > 1) Just for this association - use the 'order' key when setting up the
> > association in categories model... eg.
>
> >http://book.cakephp.org/view/78/Associations-Linking-Models-Together#...
>
> > 2) Globally - add it into the products model.
>
> > var $order = 'Product.name DESC';
>
> > Cheers,
> > Adam
>
> > On Dec 31, 7:31 am, Daniel <theworldof...@gmail.com> wrote:
>
> > > Hi, me again, I hope you don't mind me coming back with another
> > > question.
>
> > > I'm not sure if I'm going about this the best way or not, so some
> > > general advice would be handy.
>
> > > I've got two models: Category and Product, Product belongs to
> > > Category, with Category having many Product (with me so far?).
>
> > > I'm using the view function within the Categories controller to list
> > > the products displayed within that category. I'm using the read()
> > > function to pull the data from the Category model, which of course is
> > > pulling with it data from the associated Product model - which I'm
> > > then just using a simple foreach ($category['Product'] as $product) {}
> > > to display within the view.
>
> > > Two questions - first, is this the best way of displaying products
> > > within a specific category.
>
> > > Second - is there anyway to change the order of the $category
> > > ['Product'] array, so that it's ordered by a field other than the id.
>
> > > Thank you
>
> > > - Daniel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Problem with auth component

What does your AppController beforeFilter() look like?

http://www.milesj.me/blog/read/5/using-cakephps-auth-component/
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: buttons in cakephp

http://groups.google.com/group/cake-php/browse_thread/thread/48835c8925d3ca7a#

You already asked this. There is a search function.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: findCount different then find('count')

Ah that was probably it. Its just one of those small things you keep
unnoticing.

On Dec 30, 6:51 am, mark_story <mark.st...@gmail.com> wrote:
> Yes this is correct. You need the conditions key, all the new style
> calls require there to be a conditions key if you want to include
> conditions.
>
> -Mark
>
> On Dec 30, 6:45 am, jason m <ippatsu.ya...@gmail.com> wrote:
>
> > i think it should be
>
> > return $this->find('count', array('conditions'=>$conditions));
>
> > On Dec 30, 2:59 pm, gearvOsh <mileswjohn...@gmail.com> wrote:
>
> > > All I did was this:
>
> > > return $this->find('count', $conditions);
> > > return $this->findCount($conditions);
>
> > > $conditions = array('OR' => array(
> > >  'Friend.user_id'        => $user_id,
> > >  'Friend.friend_id'      => $user_id
> > >  ));
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: How to change data of dropdown box when value of other dropdown box changes

Ok you keep asking like 10 questions a day here.

1 - Read the CakePHP manual
2 - What you want to do is JSON/Javascript
3 - Perhaps actually learn PHP or Cake
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Re: Polymorphic behavior troubles

Hey, Andy, thanks for the reply. Sorry, I've been under a strict
offline status enforcement ;-)

I've actually got this working, using ExtendableBehavior and a Member
class which extends User. It seems to be fine now.

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

Re: Order associated data

Hi, thank you for the advice - the first one works fine, but the
second one doesn't.

I've added it to the top of the Product model, just below the $name
variable, like so:

var $name = 'Product';
var $order = 'Product.title ASC';

Any idea?

On Dec 30, 10:04 pm, Adam Royle <a...@sleekgeek.com.au> wrote:
> Yes, you've got the categories/products thing set up as I would do it.
>
> With ordering, you can do it both ways:
>
> 1) Just for this association - use the 'order' key when setting up the
> association in categories model... eg.
>
> http://book.cakephp.org/view/78/Associations-Linking-Models-Together#...
>
> 2) Globally - add it into the products model.
>
> var $order = 'Product.name DESC';
>
> Cheers,
> Adam
>
> On Dec 31, 7:31 am, Daniel <theworldof...@gmail.com> wrote:
>
> > Hi, me again, I hope you don't mind me coming back with another
> > question.
>
> > I'm not sure if I'm going about this the best way or not, so some
> > general advice would be handy.
>
> > I've got two models: Category and Product, Product belongs to
> > Category, with Category having many Product (with me so far?).
>
> > I'm using the view function within the Categories controller to list
> > the products displayed within that category. I'm using the read()
> > function to pull the data from the Category model, which of course is
> > pulling with it data from the associated Product model - which I'm
> > then just using a simple foreach ($category['Product'] as $product) {}
> > to display within the view.
>
> > Two questions - first, is this the best way of displaying products
> > within a specific category.
>
> > Second - is there anyway to change the order of the $category
> > ['Product'] array, so that it's ordered by a field other than the id.
>
> > Thank you
>
> > - Daniel

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

Re: Order associated data

Yes, you've got the categories/products thing set up as I would do it.

With ordering, you can do it both ways:

1) Just for this association - use the 'order' key when setting up the
association in categories model... eg.

http://book.cakephp.org/view/78/Associations-Linking-Models-Together#Relationship-Types-79

2) Globally - add it into the products model.

var $order = 'Product.name DESC';

Cheers,
Adam

On Dec 31, 7:31 am, Daniel <theworldof...@gmail.com> wrote:
> Hi, me again, I hope you don't mind me coming back with another
> question.
>
> I'm not sure if I'm going about this the best way or not, so some
> general advice would be handy.
>
> I've got two models: Category and Product, Product belongs to
> Category, with Category having many Product (with me so far?).
>
> I'm using the view function within the Categories controller to list
> the products displayed within that category. I'm using the read()
> function to pull the data from the Category model, which of course is
> pulling with it data from the associated Product model - which I'm
> then just using a simple foreach ($category['Product'] as $product) {}
> to display within the view.
>
> Two questions - first, is this the best way of displaying products
> within a specific category.
>
> Second - is there anyway to change the order of the $category
> ['Product'] array, so that it's ordered by a field other than the id.
>
> Thank you
>
> - Daniel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Order associated data

Hi, me again, I hope you don't mind me coming back with another
question.

I'm not sure if I'm going about this the best way or not, so some
general advice would be handy.

I've got two models: Category and Product, Product belongs to
Category, with Category having many Product (with me so far?).

I'm using the view function within the Categories controller to list
the products displayed within that category. I'm using the read()
function to pull the data from the Category model, which of course is
pulling with it data from the associated Product model - which I'm
then just using a simple foreach ($category['Product'] as $product) {}
to display within the view.

Two questions - first, is this the best way of displaying products
within a specific category.

Second - is there anyway to change the order of the $category
['Product'] array, so that it's ordered by a field other than the id.

Thank you

- Daniel

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

Re: file uploading in cake php

http://www.meiocodigo.com/projects/meioupload/

On Sun, Dec 28, 2008 at 12:40 PM, mona <poojapinjani@gmail.com> wrote:
>
>
> I tried alot but it is not working any other options
> >
>

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

Re: Model data in all views

Fantastic, thank you :)

- Daniel

On Dec 30, 8:11 pm, Bernardo Vieira <bvieira.li...@gmail.com> wrote:
<snip>

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