Re: HABTM - SQL Error 1062 w/ 1.2 RC3

2008-10-03 Thread Keith
Nevermind...lol too late to be coding...

For some reason the user_id column in the departments_users table had
been set as a primary key.  I'm not exactly sure why, but who knows
maybe I totally bailed and set a primary key flag somewhere along the
line.

Everything is working though.

On 4 Oct, 01:12, Keith <[EMAIL PROTECTED]> wrote:
> I have a situation where I have a user model & a department model.
>
> MODEL - User.php
>
>         var $hasAndBelongsToMany = array(
>                         'Department' => array('className' => 'Department',
>                                                 'joinTable' => 
> 'departments_users',
>                                                 'foreignKey' => 'user_id',
>                                                 'associationForeignKey' => 
> 'department_id',
>                                                 'unique' => true,
>                                                 'conditions' => '',
>                                                 'fields' => '',
>                                                 'order' => '',
>                                                 'limit' => '',
>                                                 'offset' => '',
>                                                 'finderQuery' => '',
>                                                 'deleteQuery' => '',
>                                                 'insertQuery' => ''
>                         )
>         );
>
> MODEL - department.php
>
>         var $hasAndBelongsToMany = array(
>                         'User' => array('className' => 'User',
>                                                 'joinTable' => 
> 'departments_users',
>                                                 'foreignKey' => 
> 'department_id',
>                                                 'associationForeignKey' => 
> 'user_id',
>                                                 'unique' => true,
>                                                 'conditions' => '',
>                                                 'fields' => '',
>                                                 'order' => '',
>                                                 'limit' => '',
>                                                 'offset' => '',
>                                                 'finderQuery' => '',
>                                                 'deleteQuery' => '',
>                                                 'insertQuery' => ''
>                         )
>         );
>
> So...my problem is this:
>
> I baked my application's controllers, views, and models via the
> console and they are still the defaults.
>
> I currently have 2 users & 2 departments in the database.
>
> Whenever I associate a user with a single department (doesn't matter
> which one) everything works fine.
>
> Whenever I associate a user with both departments I get the following
> error:
>
> Warning (512): SQL Error: 1062: Duplicate entry '2' for key 1 [CORE/
> cake/libs/model/datasources/dbo_source.php, line 521]
>
> Query: INSERT INTO `departments_users` (`user_id`,`department_id`)
> VALUES (2,'1'), (2,'2')
>
> Any help would be greatly appreciated.   This project was created
> exclusively with the 1.2 RC3 so it wasn't an upgrade or anything like
> that from RC2 or before.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



HABTM - SQL Error 1062 w/ 1.2 RC3

2008-10-03 Thread Keith

I have a situation where I have a user model & a department model.

MODEL - User.php

var $hasAndBelongsToMany = array(
'Department' => array('className' => 'Department',
'joinTable' => 
'departments_users',
'foreignKey' => 'user_id',
'associationForeignKey' => 
'department_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);

MODEL - department.php

var $hasAndBelongsToMany = array(
'User' => array('className' => 'User',
'joinTable' => 
'departments_users',
'foreignKey' => 'department_id',
'associationForeignKey' => 
'user_id',
'unique' => true,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
)
);

So...my problem is this:

I baked my application's controllers, views, and models via the
console and they are still the defaults.

I currently have 2 users & 2 departments in the database.

Whenever I associate a user with a single department (doesn't matter
which one) everything works fine.

Whenever I associate a user with both departments I get the following
error:

Warning (512): SQL Error: 1062: Duplicate entry '2' for key 1 [CORE/
cake/libs/model/datasources/dbo_source.php, line 521]

Query: INSERT INTO `departments_users` (`user_id`,`department_id`)
VALUES (2,'1'), (2,'2')

Any help would be greatly appreciated.   This project was created
exclusively with the 1.2 RC3 so it wasn't an upgrade or anything like
that from RC2 or before.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Effect.Fade and Effect.Appear

2008-10-03 Thread Arak Tai'Roth

I did read those, and realize that Effect.Appear only works on a style
declared within the div tag, I have done that. However beyond that I
don't see anything on those pages that relate to this problem. Unless
Effect.Fade doesn't work on styles that are set in that matter.

I figured it was a Javascript problem and as such posted it on the
Scriptaculous google groups but did not recieve a response on there
either.

On Oct 3, 2:58 am, Dinko <[EMAIL PROTECTED]> wrote:
> This is rather a Javascript problem, not Cake.
>
> Have a look 
> athttp://github.com/madrobby/scriptaculous/wikis/effect-appearhttp://github.com/madrobby/scriptaculous/wikis/effect-fade
>
> which should help you.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



[ANN][OT] News about the CakePHP Portuguese Google Groups

2008-10-03 Thread Gustavo Carreno

Hey guys,

I feel I still need to apologise for my utter stupidity on losing my
other Google Mail account.
Not only because I was stupid but, now, my stupidity has harmed the
Portuguese CakePHP community.

In the past hours I was alerted that the cake-php-pt GG was deleted.
I immediately began to try and find out why, but to no avail.
It could be 1 of 2 things:
* My hacked account got deleted and all that was associated is down. I
hope this is it.
* The "hackers" chose to delete the group.

But that is water under the bridge now.
A new group has been created: http://groups.google.com/group/cakephp-pt
We have over 60 invitations pending for old member and around 20
something are already in.

To avoid future risks I've set many other users as owners, this way
it's not dependent on only one account.

I invite all of you that speak the Portuguese language to re-hook on
this new one.

Again I sincerely apologise for my utter stupidity.

Cheers,
Gus

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Another HABTM issue : row with same Id getting over-written

2008-10-03 Thread Brenton B

Ok, so here's the scenario ...

A user can have multiple webpages in their account, and when they set
them up, they must choose the type (ex: blog, gallery, etc). So User
HABTM webpage_type ... where users_webpage_types has additional fields
for URL, title, etc.

The thing I'm running into is upon retrieving: If an user has 2 of the
same webpage_type, it performs the SQL to get 'em all, but once it's
done it's magic, it only has the first record. I'm assuming this is
due to the occurrence of the same webpage_type_id, but still lost ...

User::

var $hasAndBelongsToMany = array(
'WebpageType' => array('className' => 'WebpageType',
'joinTable' => 
'users_webpage_types',
'foreignKey' => 'userr_id',
'associationForeignKey' => 
'webpage_type_id',
'with' => 'UsersWebpageType',
'unique' => true,
),


WebpageType::

var $hasAndBelongsToMany = array(
'User' => array('className' => 'User',
'joinTable' => 
'users_webpage_types',
'foreignKey' => 
'webpage_type_id',
'associationForeignKey' => 
'user_id',
'with' => 'UsersWebpageType',
'unique' => true,


UsersWebpageType::

var $belongsTo = array(
'User' => array('className' => 'User',
'foreignKey' => 
'user_id',
'conditions' => 
'',
'fields' => '',
'order' => ''
),
'WebpageType' => array('className' => 'WebpageType',
'foreignKey' => 
'webpage_type_id',
'conditions' => 
'',
'fields' => '',
'order' => ''
)
);


Seriously confused 

I've searched the group, and came up empty handed - probably due to
diff keywords.

Cheers.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



sorting a model based on child count ?? (full email)

2008-10-03 Thread Matthew Camuto
 Apologies in advance. GMAIL auto-sent my last emal before finishing!

hi there

thsi group is great firstly and i have been doing pretty well with cake.
however i was trying something that is either

absurdly simple or not possible. i want to get my model out (via db) but i
want to sort it based on the count of a set

of children (has many). The simplist example is

Article

has many Reviews

And I want to retrieve all the articles orderd solely on Review count. I was
not sure if I could do this strictly through

query or in a combo of a query along with the 'Set' helper class or if I
would have to write my complete own sorting function..

Thanks in advance

matt

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



sorting a model based on child count?!?

2008-10-03 Thread Matthew Camuto
hi there

thsi group is great firstly and i have been doing pretty well with cake.
however i was trying something that is either
absurdly simple or not possible. i want to get my model out (via db) but i
want to sort it based on the count of a set
of children (has many). The simplist example is

Article

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Another HABTM issue : row with same Id getting over-written

2008-10-03 Thread Brenton B

Well, assuming the Docs are correct (and I understand it properly),
that should only apply to updates ("If true (default value) cake will
first delete existing relationship records in the foreign keys table
before inserting new ones, when updating a record. So existing
associations need to be passed again when updating").

However, in my circumstance, I'm just retrieving information ...

Debug SQL shows the (as expected) query of getting all webpages &
types based on the user_id, and it retrieves all the information
that's needed; however, by the time I get to the view (where I have a
`pr()`), I've magically lost one of 'em - well, actually, any
subsequent webpage_type record that has the same id.

Conventions: Yeah, I know those were just there, left over from
scaffolding, so figured no harm in leaving 'em ...


On Oct 3, 3:19 pm, teknoid <[EMAIL PROTECTED]> wrote:
> Do you know what 'unique'=>true does?
>
> Btw, there really isn't any need to define default values for your
> associations if you follow the conventions.
>
> On Oct 3, 6:10 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > Ok, so here's the scenario ...
>
> > A user can have multiple webpages in their account, and when they set
> > them up, they must choose the type (ex: blog, gallery, etc). So User
> > HABTM webpage_type ... where users_webpage_types has additional fields
> > for URL, title, etc.
>
> > The thing I'm running into is upon retrieving: If an user has 2 of the
> > same webpage_type, it performs the SQL to get 'em all, but once it's
> > done it's magic, it only has the first record. I'm assuming this is
> > due to the occurrence of the same webpage_type_id, but still lost ...
>
> > User::
>
> > var $hasAndBelongsToMany = array(
> > 'WebpageType' => array('className' => 'WebpageType',
> > 'joinTable' => 
> > 'users_webpage_types',
> > 'foreignKey' => 'userr_id',
> > 'associationForeignKey' => 
> > 'webpage_type_id',
> > 'with' => 
> > 'UsersWebpageType',
> > 'unique' => true,
> > ),
>
> > WebpageType::
>
> > var $hasAndBelongsToMany = array(
> > 'User' => array('className' => 'User',
> > 'joinTable' => 
> > 'users_webpage_types',
> > 'foreignKey' => 
> > 'webpage_type_id',
> > 'associationForeignKey' => 
> > 'user_id',
> > 'with' => 
> > 'UsersWebpageType',
> > 'unique' => true,
>
> > UsersWebpageType::
>
> > var $belongsTo = array(
> > 'User' => array('className' => 'User',
> > 
> > 'foreignKey' => 'user_id',
> > 
> > 'conditions' => '',
> > 'fields' => 
> > '',
> > 'order' => 
> > ''
> > ),
> > 'WebpageType' => array('className' => 'WebpageType',
> > 
> > 'foreignKey' => 'webpage_type_id',
> > 
> > 'conditions' => '',
> > 'fields' => 
> > '',
> > 'order' => 
> > ''
> > )
> > );
>
> > Seriously confused 
>
> > I've searched the group, and came up empty handed - probably due to
> > diff keywords.
>
> > Cheers.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: URL routing

2008-10-03 Thread Mathew Nik Foscarini
Hi,

There are two way to handle this. 

Add these lines above your other users routing rules. If you put it below your 
other rules, then the router will think "login" is a username. This is not an 
advisable approach since you can no longer have users with the names "login" or 
"logout", and every time you need to add a new action to the UsersController 
you'll have to add another rules.

Router::connect('/users/login',array('controller'=>'users','action'=>'login'));
Router::connect('/users/logout',array('controller'=>'users','action'=>'logout'));

You can get around this with the second approach by not using the prefix of 
users for non-user related actions.

Router::connect('/members/:action',array('controller'=>'users'));

Now your logins can be handled by http://example.com/members/logout and 
http://example.com/members/login

You can also just keep it real simple http://example.com/login would be

Router::connect('/login',array('controller'=>'users','action'=>'login'));


- Original Message 
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
To: CakePHP 
Sent: Friday, October 3, 2008 5:16:31 PM
Subject: Re: URL routing


Great, that helped a lot.  A follow up issue I am having is what is
the correct way to handle such things as login / logout functions in
the user controller so that when I go to http://example.com/users/logout,
it doesn't query the database and it performs the logout functions.

Thanks again for your help before

On Oct 3, 9:41 am, Mathew <[EMAIL PROTECTED]> wrote:
> Router::connect('/users/:username',
> array('controller'=>'users','action'=>'index'),array('pass'=>array('username')));
>
> This routes /users/bobcostas to the function index( $username ) method
> of the controller, with the username passed as a parameter.
>
> Router::connect('/users/:username/:action',
> array('controller'=>'users'),array('pass'=>array('username')));
>
> This does the same as the above, but allows the action to be after the
> username. For example; /users/bobcostas/edit would call function
> edit( $username ) in the UsersController.


  
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Another HABTM issue : row with same Id getting over-written

2008-10-03 Thread teknoid

Goes to show I should read more carefully :)
I guess the title of the post made me jump the gun...

You say "an user has 2 of the same webpage_type"

Does it mean that in your join table you have something like: ?
user_id | web_page_type_id
-
7  |  6
7  |  6

On Oct 3, 6:27 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> Well, assuming the Docs are correct (and I understand it properly),
> that should only apply to updates ("If true (default value) cake will
> first delete existing relationship records in the foreign keys table
> before inserting new ones, when updating a record. So existing
> associations need to be passed again when updating").
>
> However, in my circumstance, I'm just retrieving information ...
>
> Debug SQL shows the (as expected) query of getting all webpages &
> types based on the user_id, and it retrieves all the information
> that's needed; however, by the time I get to the view (where I have a
> `pr()`), I've magically lost one of 'em - well, actually, any
> subsequent webpage_type record that has the same id.
>
> Conventions: Yeah, I know those were just there, left over from
> scaffolding, so figured no harm in leaving 'em ...
>
> On Oct 3, 3:19 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > Do you know what 'unique'=>true does?
>
> > Btw, there really isn't any need to define default values for your
> > associations if you follow the conventions.
>
> > On Oct 3, 6:10 pm, Brenton B <[EMAIL PROTECTED]> wrote:
>
> > > Ok, so here's the scenario ...
>
> > > A user can have multiple webpages in their account, and when they set
> > > them up, they must choose the type (ex: blog, gallery, etc). So User
> > > HABTM webpage_type ... where users_webpage_types has additional fields
> > > for URL, title, etc.
>
> > > The thing I'm running into is upon retrieving: If an user has 2 of the
> > > same webpage_type, it performs the SQL to get 'em all, but once it's
> > > done it's magic, it only has the first record. I'm assuming this is
> > > due to the occurrence of the same webpage_type_id, but still lost ...
>
> > > User::
>
> > >         var $hasAndBelongsToMany = array(
> > >                         'WebpageType' => array('className' => 
> > > 'WebpageType',
> > >                                                 'joinTable' => 
> > > 'users_webpage_types',
> > >                                                 'foreignKey' => 
> > > 'userr_id',
> > >                                                 'associationForeignKey' 
> > > => 'webpage_type_id',
> > >                                                 'with' => 
> > > 'UsersWebpageType',
> > >                                                 'unique' => true,
> > >                         ),
>
> > > WebpageType::
>
> > >         var $hasAndBelongsToMany = array(
> > >                         'User' => array('className' => 'User',
> > >                                                 'joinTable' => 
> > > 'users_webpage_types',
> > >                                                 'foreignKey' => 
> > > 'webpage_type_id',
> > >                                                 'associationForeignKey' 
> > > => 'user_id',
> > >                                                 'with' => 
> > > 'UsersWebpageType',
> > >                                                 'unique' => true,
>
> > > UsersWebpageType::
>
> > >         var $belongsTo = array(
> > >                         'User' => array('className' => 'User',
> > >                                                                 
> > > 'foreignKey' => 'user_id',
> > >                                                                 
> > > 'conditions' => '',
> > >                                                                 'fields' 
> > > => '',
> > >                                                                 'order' 
> > > => ''
> > >                         ),
> > >                         'WebpageType' => array('className' => 
> > > 'WebpageType',
> > >                                                                 
> > > 'foreignKey' => 'webpage_type_id',
> > >                                                                 
> > > 'conditions' => '',
> > >                                                                 'fields' 
> > > => '',
> > >                                                                 'order' 
> > > => ''
> > >                         )
> > >         );
>
> > > Seriously confused 
>
> > > I've searched the group, and came up empty handed - probably due to
> > > diff keywords.
>
> > > Cheers.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~

Re: CakePHP does not work with mod_rewrite and php-cgi

2008-10-03 Thread powtac

Exact error message? What is not found?

On 3 Okt., 23:05, dtrax84 <[EMAIL PROTECTED]> wrote:
> Hi,
> Tried running cakephp on my server with php-cgi with mod_rewrite
> enabled and got the error 404 message. Any ideas?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to use the shell output in controller?

2008-10-03 Thread powtac

Silly question I know, but is there a other way beside "exec()" and
"ob_start()" to call the functionality of a cake shell from inside a
controller?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Another HABTM issue : row with same Id getting over-written

2008-10-03 Thread teknoid
Do you know what 'unique'=>true does?

Btw, there really isn't any need to define default values for your
associations if you follow the conventions.

On Oct 3, 6:10 pm, Brenton B <[EMAIL PROTECTED]> wrote:
> Ok, so here's the scenario ...
>
> A user can have multiple webpages in their account, and when they set
> them up, they must choose the type (ex: blog, gallery, etc). So User
> HABTM webpage_type ... where users_webpage_types has additional fields
> for URL, title, etc.
>
> The thing I'm running into is upon retrieving: If an user has 2 of the
> same webpage_type, it performs the SQL to get 'em all, but once it's
> done it's magic, it only has the first record. I'm assuming this is
> due to the occurrence of the same webpage_type_id, but still lost ...
>
> User::
>
>         var $hasAndBelongsToMany = array(
>                         'WebpageType' => array('className' => 'WebpageType',
>                                                 'joinTable' => 
> 'users_webpage_types',
>                                                 'foreignKey' => 'userr_id',
>                                                 'associationForeignKey' => 
> 'webpage_type_id',
>                                                 'with' => 'UsersWebpageType',
>                                                 'unique' => true,
>                         ),
>
> WebpageType::
>
>         var $hasAndBelongsToMany = array(
>                         'User' => array('className' => 'User',
>                                                 'joinTable' => 
> 'users_webpage_types',
>                                                 'foreignKey' => 
> 'webpage_type_id',
>                                                 'associationForeignKey' => 
> 'user_id',
>                                                 'with' => 'UsersWebpageType',
>                                                 'unique' => true,
>
> UsersWebpageType::
>
>         var $belongsTo = array(
>                         'User' => array('className' => 'User',
>                                                                 'foreignKey' 
> => 'user_id',
>                                                                 'conditions' 
> => '',
>                                                                 'fields' => 
> '',
>                                                                 'order' => ''
>                         ),
>                         'WebpageType' => array('className' => 'WebpageType',
>                                                                 'foreignKey' 
> => 'webpage_type_id',
>                                                                 'conditions' 
> => '',
>                                                                 'fields' => 
> '',
>                                                                 'order' => ''
>                         )
>         );
>
> Seriously confused 
>
> I've searched the group, and came up empty handed - probably due to
> diff keywords.
>
> Cheers.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



CakePHP does not work with mod_rewrite and php-cgi

2008-10-03 Thread dtrax84

Hi,
Tried running cakephp on my server with php-cgi with mod_rewrite
enabled and got the error 404 message. Any ideas?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Mod_Rewrite and PHP-CGI

2008-10-03 Thread dtrax84

Hi,
I am having problems running cakephp on my server (Server API: CGI)
using mod_rewrite. Does anyone has the same 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Layout switching breaks $scripts_for_layout

2008-10-03 Thread matt

Hi,
I am getting a weird issue when i change the default layout being
displayed.

Normally the following code works as expected ($scrips_for_layout is
populated):

(app/views/layout/default.ctp)
meta('icon');
  $html->css('cake.generic', null, array(), false);
  echo $scripts_for_layout;
?>

Except when the layout is changed ($scripts_for_layout is empty):

(app/app_controller.php)
params[Configure::read('Routing.admin')] && !$this-
>RequestHandler->isAjax()) {
  $this->layout = 'admin';
}

  parent::beforeFilter();
}
?>

(app/views/layout/admin.ctp)
meta('icon');
  $html->css('cake.generic', null, array(), false);
  echo $scripts_for_layout;
?>

Can anyone think of a reason why this is?

Thanks,
matt

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: URL routing

2008-10-03 Thread [EMAIL PROTECTED]

Great, that helped a lot.  A follow up issue I am having is what is
the correct way to handle such things as login / logout functions in
the user controller so that when I go to http://example.com/users/logout,
it doesn't query the database and it performs the logout functions.

Thanks again for your help before

On Oct 3, 9:41 am, Mathew <[EMAIL PROTECTED]> wrote:
> Router::connect('/users/:username',
> array('controller'=>'users','action'=>'index'),array('pass'=>array('username')));
>
> This routes /users/bobcostas to the function index( $username ) method
> of the controller, with the username passed as a parameter.
>
> Router::connect('/users/:username/:action',
> array('controller'=>'users'),array('pass'=>array('username')));
>
> This does the same as the above, but allows the action to be after the
> username. For example; /users/bobcostas/edit would call function
> edit( $username ) in the UsersController.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: URL routing

2008-10-03 Thread [EMAIL PROTECTED]

Great, that helped a lot.  A follow up issue I am having is what is
the correct way to handle such things as login / logout functions in
the user controller so that when I go to http://example.com/users/logout,
it doesn't query the database and it performs the logout functions.

Thanks again for your help before

On Oct 3, 9:41 am, Mathew <[EMAIL PROTECTED]> wrote:
> Router::connect('/users/:username',
> array('controller'=>'users','action'=>'index'),array('pass'=>array('username')));
>
> This routes /users/bobcostas to the function index( $username ) method
> of the controller, with the username passed as a parameter.
>
> Router::connect('/users/:username/:action',
> array('controller'=>'users'),array('pass'=>array('username')));
>
> This does the same as the above, but allows the action to be after the
> username. For example; /users/bobcostas/edit would call function
> edit( $username ) in the UsersController.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Multiple Display Field

2008-10-03 Thread Keith

I don't understand why this issue still lingers on and on in cakePHP.

Why not just have the following syntax:

(If you only have 1 field)
var $displayField = 'last_name';

(If you have multiple fields)
var $displayField = array(
 'fields' = array(
  'last_name',
  'first_name'),
 'pattern' = '%s,%s'
);

That's a concatenation of a number of people's suggestions that have
been floating around for over 3 years.  Please tell me something is in
1.2 that facilitates that kind of formatting without resorting to
writing a bunch of extraneous methods for something any application
with users and and admin panel will likely need at some point.

- Keith

On Sep 24, 11:19 am, Kanten <[EMAIL PROTECTED]> wrote:
> Well that seems simpler, but I do like the thought of having this as a
> behavior.
>
> /Anders
>
> On Sep 24, 4:29 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
>
>
> > I'm not familiar with that behavior, but I can offer you another
> > solution, which will work just fine if you need to combine two
> > fields...
>
> >http://teknoid.wordpress.com/2008/09/04/findlist-with-three-or-combin...
>
> > On Sep 24, 9:03 am, Kanten <[EMAIL PROTECTED]> wrote:
>
> > > I'm trying to use the Multiple Display Field behavior as described
> > > here:http://bakery.cakephp.org/articles/view/multiple-display-field-3
>
> > > I run into two problems when using this:
> > > 1. Cake generates two error messages whenever I load a page that uses
> > > this behavior:
> > > "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 'varDump' at line 1 [CORE\cake\libs\model
> > > \datasources\dbo_source.php, line 512]"
> > > And
> > > "mysqli_real_escape_string() expects parameter 2 to be string, array
> > > given [CORE\cake\libs\model\datasources\dbo\dbo_mysqli.php, line 259]"
>
> > > 2. I cannot figure out how to use a non-existent field as
> > > $display_field. Whenever I try do this I get an error. For instance I
> > > would like to use the field full_name, that isn't in my db table.
>
> > > My code is a folllows:
>
> > > class User extends AppModel {
>
> > >         var $displayField = 'first_name';
>
> > >         var $actsAs = array('MultipleDisplayFields' => array(
> > >         'fields' => array('first_name', 'last_name'),
> > >         'pattern' => '%s %s'
> > >     ));
>
> > > }
>
> > > Anyone?
>
> > > /Anders, Denmark- 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread qwanta

If it's a one to many relationship (author has many books, each book
has one author):

In Book Model you stick this:
var $belongsTo = array ('Author');

In Author Model:
var $hasMany = array ('Book');

http://book.cakephp.org/view/78/Associations-Linking-Models-Together

I'd recommend going through these tutorials:

http://www.sitepoint.com/article/application-development-cakephp/
http://www.davidgoldingdesign.com/newbie-cakephp.pdf


On Oct 3, 1:36 pm, "Abdus Salaam" <[EMAIL PROTECTED]> wrote:
> thanx for ur time.
> - ya u r rite that htmlhelper is easy way to genrate tables cell and
> headers..
> but i m trying to learn some code myself.. :p
> - i m trying to made relationship b/w books and authors tables...i think its
> relation is not make properly.
> -how to make foreign key?..i think thats the problem.
> thanx
>
>
>
> On Fri, Oct 3, 2008 at 11:13 PM, qwanta <[EMAIL PROTECTED]> wrote:
>
> > What you probably want to do is take a look at what you have in the
> > $books array at the end of your controller. A quick and dirty way is
> > to put a var_dump($books); as last statement in your controller
> > function. The contents will then show up at the top of your view.
> > Check if the ['Author']['name'] data is there.
> > Does it work without recursive=1? (My guess is the problem is to do
> > with the Author table and your model definition)
>
> > FYI, the htmlhelper::tableCells & tableHeaders functions are nice for
> > generating tables. :)
>
> > I believe also that the preferred way in cakephp 1.2 to optimize
> > database calls is to use containable behavior. ie.
> > replace
> > $this->Book->recursive = 1;
> > with
> > $this->Book->contain('Author');
>
> >http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/
>
> > But try getting it to work first without optimization.
>
> > On Oct 3, 1:14 am, "S/*\\L/*\\L/*\\M" <[EMAIL PROTECTED]> wrote:
> > > hi all,
> > > i m very new in cakePHP, pls help me some one about this error, which
> > > is headeach for me.
> > > => i m getting error of [Undefined index] in  abc view file.i m
> > > pasting code here if some 1 got it then pls help me.
> > > thanx
>
> > > =>this controller file code for index...
> > > function index() {
> > > $this->Book->recursive = 1;
> > > $books = $this->Book->find('all');
> > > $this->set('books', $books);
>
> > > }
>
> > > =>and this one code for index.ctp
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > i am waiting :)
>
> --
> Best Regards
> ABDUS SALAAM
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread qwanta

Note also you have to have your tables defined according to the
CakePHP syntax. Each one should have an "id" key column. Then the Book
table should have an author_id field to link the author.

On Oct 3, 2:54 pm, qwanta <[EMAIL PROTECTED]> wrote:
> If it's a one to many relationship (author has many books, each book
> has one author):
>
> In Book Model you stick this:
> var $belongsTo = array ('Author');
>
> In Author Model:
> var $hasMany = array ('Book');
>
> http://book.cakephp.org/view/78/Associations-Linking-Models-Together
>
> I'd recommend going through these tutorials:
>
> http://www.sitepoint.com/article/application-development-cakephp/http://www.davidgoldingdesign.com/newbie-cakephp.pdf
>
> On Oct 3, 1:36 pm, "Abdus Salaam" <[EMAIL PROTECTED]> wrote:
>
> > thanx for ur time.
> > - ya u r rite that htmlhelper is easy way to genrate tables cell and
> > headers..
> > but i m trying to learn some code myself.. :p
> > - i m trying to made relationship b/w books and authors tables...i think its
> > relation is not make properly.
> > -how to make foreign key?..i think thats the problem.
> > thanx
>
> > On Fri, Oct 3, 2008 at 11:13 PM, qwanta <[EMAIL PROTECTED]> wrote:
>
> > > What you probably want to do is take a look at what you have in the
> > > $books array at the end of your controller. A quick and dirty way is
> > > to put a var_dump($books); as last statement in your controller
> > > function. The contents will then show up at the top of your view.
> > > Check if the ['Author']['name'] data is there.
> > > Does it work without recursive=1? (My guess is the problem is to do
> > > with the Author table and your model definition)
>
> > > FYI, the htmlhelper::tableCells & tableHeaders functions are nice for
> > > generating tables. :)
>
> > > I believe also that the preferred way in cakephp 1.2 to optimize
> > > database calls is to use containable behavior. ie.
> > > replace
> > > $this->Book->recursive = 1;
> > > with
> > > $this->Book->contain('Author');
>
> > >http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/
>
> > > But try getting it to work first without optimization.
>
> > > On Oct 3, 1:14 am, "S/*\\L/*\\L/*\\M" <[EMAIL PROTECTED]> wrote:
> > > > hi all,
> > > > i m very new in cakePHP, pls help me some one about this error, which
> > > > is headeach for me.
> > > > => i m getting error of [Undefined index] in  abc view file.i m
> > > > pasting code here if some 1 got it then pls help me.
> > > > thanx
>
> > > > =>this controller file code for index...
> > > > function index() {
> > > > $this->Book->recursive = 1;
> > > > $books = $this->Book->find('all');
> > > > $this->set('books', $books);
>
> > > > }
>
> > > > =>and this one code for index.ctp
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > i am waiting :)
>
> > --
> > Best Regards
> > ABDUS SALAAM
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread Abdus Salaam
thanx for ur time.
- ya u r rite that htmlhelper is easy way to genrate tables cell and
headers..
but i m trying to learn some code myself.. :p
- i m trying to made relationship b/w books and authors tables...i think its
relation is not make properly.
-how to make foreign key?..i think thats the problem.
thanx

On Fri, Oct 3, 2008 at 11:13 PM, qwanta <[EMAIL PROTECTED]> wrote:

>
> What you probably want to do is take a look at what you have in the
> $books array at the end of your controller. A quick and dirty way is
> to put a var_dump($books); as last statement in your controller
> function. The contents will then show up at the top of your view.
> Check if the ['Author']['name'] data is there.
> Does it work without recursive=1? (My guess is the problem is to do
> with the Author table and your model definition)
>
> FYI, the htmlhelper::tableCells & tableHeaders functions are nice for
> generating tables. :)
>
> I believe also that the preferred way in cakephp 1.2 to optimize
> database calls is to use containable behavior. ie.
> replace
> $this->Book->recursive = 1;
> with
> $this->Book->contain('Author');
>
> http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/
>
> But try getting it to work first without optimization.
>
> On Oct 3, 1:14 am, "S/*\\L/*\\L/*\\M" <[EMAIL PROTECTED]> wrote:
> > hi all,
> > i m very new in cakePHP, pls help me some one about this error, which
> > is headeach for me.
> > => i m getting error of [Undefined index] in  abc view file.i m
> > pasting code here if some 1 got it then pls help me.
> > thanx
> >
> > =>this controller file code for index...
> > function index() {
> > $this->Book->recursive = 1;
> > $books = $this->Book->find('all');
> > $this->set('books', $books);
> >
> > }
> >
> > =>and this one code for index.ctp
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > i am waiting :)
> >
>


-- 
Best Regards
ABDUS SALAAM

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread qwanta

What you probably want to do is take a look at what you have in the
$books array at the end of your controller. A quick and dirty way is
to put a var_dump($books); as last statement in your controller
function. The contents will then show up at the top of your view.
Check if the ['Author']['name'] data is there.
Does it work without recursive=1? (My guess is the problem is to do
with the Author table and your model definition)

FYI, the htmlhelper::tableCells & tableHeaders functions are nice for
generating tables. :)

I believe also that the preferred way in cakephp 1.2 to optimize
database calls is to use containable behavior. ie.
replace
$this->Book->recursive = 1;
with
$this->Book->contain('Author');

http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/

But try getting it to work first without optimization.

On Oct 3, 1:14 am, "S/*\\L/*\\L/*\\M" <[EMAIL PROTECTED]> wrote:
> hi all,
> i m very new in cakePHP, pls help me some one about this error, which
> is headeach for me.
> => i m getting error of [Undefined index] in  abc view file.i m
> pasting code here if some 1 got it then pls help me.
> thanx
>
> =>this controller file code for index...
> function index() {
> $this->Book->recursive = 1;
> $books = $this->Book->find('all');
> $this->set('books', $books);
>
> }
>
> =>and this one code for index.ctp
> 
> 
> 
> 
> 
> 
> 
> i am waiting :)
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Auth component and ajax forms

2008-10-03 Thread CG

Did you check this var at the auth component?

/**
 * The name of an optional view element to render when an Ajax request
is made
 * with an invalid or expired session
 *
 * @var string
 * @access public
 */
var $ajaxLogin = null;

Never tried it, but i guess is something meant to do what you need.

HTH,

CG

On Oct 2, 4:17 pm, RobertoSDN <[EMAIL PROTECTED]> wrote:
> Hello, i am using ajax forms and i have a problem with the Auth
> component that works fine with the login action but not with others
> actions because only the login action has the bahavior to render a
> element to handle errors like bellow:
>
> if ($loginAction == $url) {
>    ...code} else {
>
>    if (!$this->user()) {
>         if (!$this->RequestHandler->isAjax()) {
>                 $this->Session->setFlash($this->authError, 'default', array(),
> 'auth');
>                 $this->Session->write('Auth.redirect', $url);
>                 $controller->redirect($loginAction);
>                 return false;
>         } elseif (!empty($this->ajaxLogin)) {
>                 $controller->viewPath = 'elements';
>                 echo $controller->render($this->ajaxLogin,   
> $this->RequestHandler->ajaxLayout);
>
>                 $this->_stop();
>                 return false;
>         } else {
>                 $controller->redirect(null, 403);
>         }
>    }
>
> }
>
> The problem is, when i make a request to an action that the function
> isAuthorized() returns false, the component redirect the render to a
> referer page that its layout is not a ajax layout and the view is the
> view's referer, would be a bad thing to replace the actual Auth code
> to this bellow?
>
> After this
> if ($this->isAuthorized($type)) {
>         return true;
>
> }
>
> put this
>
> if (!$this->RequestHandler->isAjax()) {
>         $this->Session->setFlash($this->authError, 'default', array(),
> 'auth');
>         $controller->redirect($controller->referer(), null, true);}else{
>
>         $controller->viewPath = 'elements';
>         echo $controller->render($this->ajaxLogin, 
> $this->RequestHandler->ajaxLayout);
>
>         $this->_stop();
>         return false;
>
> }
>
> 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Add user_id from session to db when adding a product

2008-10-03 Thread Mathew

>  if(isset($this->data['Product']['user_id'] = $user_id)) {
>  if(isset($this->data['Product']['user_id'] = $this->Auth->user('id');) {

if(($this->Auth->user('id') != null) && isset($this->data['Product']
['user_id']))
{
$this->data['Product']['user_id'] = $this->Auth->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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Release: CakePHP RC3 - The RC of Triumph!

2008-10-03 Thread Mathew

Thanks so much for all the hard work guys!

Special thanks to Mark Story, because bugs I reported were fixed the
next day by him. He's so fast! Thanks for all the hard work Mark!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to recode MySQL Boolean field to yes/no in a view

2008-10-03 Thread mikeg

if you are using scaffolding, try change column setting to TINYINT(1),
then in scaffolding you will have Yes / No :)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Changelog notes for 1.1.20 missing?

2008-10-03 Thread Daniel Hofstetter

Hi,

> Is there changelog notes for 1.1.20?
> like:https://trac.cakephp.org/wiki/changelog/1.1.x.x

I'm not aware of a changelog for 1.1, but as there were only a handful
of changes the following view might help: 
https://trac.cakephp.org/log/branches/1.1.x.x

--
Daniel Hofstetter
http://cakebaker.42dh.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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



AD7six: Multijoin relation

2008-10-03 Thread [EMAIL PROTECTED]


The association should be picture->gallery->location

when i perform a search
picture->find()

then i need as result to route the image
data[Location]
data[Gallery]
data[Picture]

in sql i would write:
FROM dp_pictures
LEFT JOIN galleries ON gallery_id   = galleries.id
LEFT JOIN locations ON location_id  = galleries.location_id

How can i realize this in cake?

Ok here are my classes:
class Location extends AppModel {
var $name = 'Location';
}

class Gallery extends AppModel {

var $name = 'Gallery';
var $belongsTo = array(
'Location' => array('className' => 'Location',
'foreignKey'
=> 'location_id',
'dependent' 
=> false
)
);
var $hasMany = array(
'Picture' => array('className'  => 'Picture',
'foreignKey'
=> 'gallery_id',
'dependent' 
=> false
),
'Random' => array('className'   => 'Picture',
'foreignKey'
=> 'gallery_id',
'order' 
=> 'RAND()',
'limit' 
=> 1
)
);
}

class Picture extends AppModel {

var $name = 'Picture';
var $belongsTo = array(
'Gallery' => array('className'  => 'Gallery',
'foreignKey'
=> 'gallery_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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Add user_id from session to db when adding a product

2008-10-03 Thread Gabriel Kolbe

Hi I would prefer to get the value from the session.

When I do
 if(isset($this->data['Product']['user_id'] = $user_id)) {
 if(isset($this->data['Product']['user_id'] = $this->Auth->user('id');) {

I get this error
Parse error: syntax error, unexpected '=', expecting ',' or ')' in
C:\xampp\htdocs\bakesale\app\controllers\products_controller.php on
line 96

Seems like it does not like the ' = ' I don't want to be a bother, but
any idea how to fix it?

Regards

On Fri, Oct 3, 2008 at 4:18 PM, Mathew <[EMAIL PROTECTED]> wrote:
>
> Assuming you want the currently logged in administrator.
>
> $this->data['Product']['user_id'] = $this->Auth->user('id');
>
> Otherwise, you'll need a belongsTo association in your Product model,
> and allow scaffolding to show a user drop down list.
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple Question

2008-10-03 Thread ORCC

When you post a form, the selected value  of a select list is in the
data array as any other form field.


> Hello all, how do I get the selected value from a select drop down
> box.  Basically I want to redirect based on the returned value however
> I can not figure out how to get the selected value?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Promlems with Fixtures using $import in RC3

2008-10-03 Thread mark_story

There were a number of problems with fixture importing in RC2, which
were corrected.  Perhaps one of these corrections broke your tests?.
For examples on fixture use check the fixture test. You can also try
specifying which connection you want to use so connection => default

-Mark

On Oct 3, 5:07 am, cdamian <[EMAIL PROTECTED]> wrote:
> I am having problems with fixtures which use $import = "SomeModel".
>
> I am getting the usual "Database table some_models for model SomeModel
> was not found."
>
> Sometimes it helps to change it to $import = array('table' =>
> 'some_models'); but this doesn't solve it all the time. Especially if
> there are multiple fixtures used in a test.
>
> Did the way fixtures should be used change in RC3, the tests were
> working in RC2 ? Or should I just stop using $import ?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread ORCC

>
> ..the comment "PERFORM BUSINESS LOGIC" should immediately
> let you think that something is not 100% MVC ..you are
> performing LOGIC inside a MODEL, and not just model data
> handling.

So, where I have to do the business logic?

For example, I have a Product Object, and the product has some taxes
that depends on the product itself (Its category, price, origin
country, etc).

Following the encapsulation principle of the object oriented
programming, I think that the object to have to know how to calculate
the product tax is the product itself. So I add a method
Product::calculateTax(); into the class Product. Tax calculation is
part of the business rules and tax value is inherent for each product,
hence, I guess that the "responsibility" of tax calculation lays in
the Product class.

Why this could violate the MVC pattern? Or is the product controller
who has to know how to calculate the product's tax?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help setting custom validation counting rule

2008-10-03 Thread Mathew

$count = $this->find('count',array('conditions'=>
$data,'recursive'=>-1));

should be

$count = $this->find('count',array('conditions'=>array('state'=>
$data),'recursive'=>-1));
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Add user_id from session to db when adding a product

2008-10-03 Thread Mathew

Assuming you want the currently logged in administrator.

$this->data['Product']['user_id'] = $this->Auth->user('id');

Otherwise, you'll need a belongsTo association in your Product model,
and allow scaffolding to show a user drop down list.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: 2 column layout for $form->input() ?

2008-10-03 Thread SiggiSmara

Maybe this is a little late but perhaps it will save some other soul
some trial and error.
I'm using 1.2 branch so this may not work for 1.1.
To change the default class name for the div that surrounds the input
when using form helper use the options array like so:
echo $form-
>input('tst_input',array('div'=>array('class'=>'tst_input')));

which results in this being the output:
Tst Input

instead of this (the default if not using the options array):
Tst Input

The same goes for the label and the input class as well. All that is
left for you then is to CSS-it to your hearts content...
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Add user_id from session to db when adding a product

2008-10-03 Thread ORCC

Just assign the values to the data array

$this->data['Product']['user_id'] = $user_id

Or put user_id as a hidden field in the form.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Add user_id from session to db when adding a product

2008-10-03 Thread gabriel

Hi, I am busy reworking a bakesale script based on cake, my OOP php is
not that good. Maybe someone can point me here in the right direction.
I want to change a script the add a product and in sert in the db the
user_id in the product table - which should come from the User.id

function admin_add($category_id = 0) {
if(isset($this->data['Product'])) {
$this->redirect(array('action' => 'edit', 'id' => $this-
>Product->bsAdd($this->data)));
} else {
$this->set('data', $this->Category->read(null, 
$category_id));
}
}

 function bsAdd($data = array()) {
$this->create();
$this->data = $data;
$this->save($this->data);
return $this->getLastInsertID();
}

Any help will be most greatful !!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Please help to create new multilanguage site in cake php

2008-10-03 Thread Donkeybob

What errors are you getting? What is the problems that you are seeing?

On Oct 3, 6:30 am, uddi <[EMAIL PROTECTED]> wrote:
> I have read the multilanguage support in cakePHP article (http://
> bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-
> internationalization-tutorial). But i am not able to run this example.
>
> Please help if anyone have any other reference Url or guidence
> material  from where i can get multilanguage support example having
> step by step procedure.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Help setting custom validation counting rule

2008-10-03 Thread 3lancer.eu

Hi again,

And what is the problem here, what query is generated?

Regards,
Piotr
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Random Image Relation

2008-10-03 Thread Markus Muschol

I want a random picture for each gallery
Is it possible to realise with a relation like this ?

Class Gallery extends AppModel {
var $hasOne= array( 'RandomImage' =>
array('className'   => 'Picture',
'foreignKey'=> 'gallery_id',
'order' => 'RAND()',
));
}

Regards

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How do i upload images using cakephp

2008-10-03 Thread Gabriel Kolbe

Hi I don't know how too but.. you can steal some ideas how to handles
images at http://www.bakesalehq.com/ since it is a ecommerce
site/template that uses images

On Fri, Oct 3, 2008 at 12:43 PM, AceStudio <[EMAIL PROTECTED]> wrote:
>
> I am developing a social community and would like members profile to
> show their pictures or avatar. Cake documentation doesn't deal with
> this at all. Please i'd appreciate if someone treated 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Release: CakePHP RC3 - The RC of Triumph!

2008-10-03 Thread tracyfloyd

Fantastic! You guys rule!
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Simple Question

2008-10-03 Thread grigri

View:

$options = array(
  '/things/view/%id' => 'View this thing',
  '/things/index' => 'Go back to the index'
);
echo $form->input('WhatToDo.next', array('options' => $options,
'label' => 'What do you want to do next?'));

Controller:

// ...
if ($this->Thing->save($this->data)) {
  $this->Session->setFlash("Your thing has been saved");
  // Grab the submitted URL or default
  $url = empty($this->data['WhatToDo']['next']) ? '/' : $this-
>data['WhatToDo']['next'];
  // Handle any parameters here
  $url = str_replace('%id%', $this->Thing->id, $url);
  // Go there
  $this->redirect($url);
}
// ...

Might be worth putting this sort of logic in a component if you use it
a lot... Also make sure you validate the submitted url

There are more secure ways of doing this, of course...

hth
grigri

On Oct 3, 3:00 pm, MDB <[EMAIL PROTECTED]> wrote:
> Hello all, how do I get the selected value from a select drop down
> box.  Basically I want to redirect based on the returned value however
> I can not figure out how to get the selected value?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Foreign Keys definition in Schemas

2008-10-03 Thread mark_story

Yes you can define additional indexes in the indexes key.  However,
you will not be able to force innodb foreign key with references, as
this feature is not supported in all databases it was not implemented
in the schema system.

On Oct 2, 8:00 pm, luissquall <[EMAIL PROTECTED]> wrote:
> I cannot find a way to define foreign keys in CakeSchemas. I suppose
> it should be inside 'indexes' key, but is it possible?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: concern regarding pagination

2008-10-03 Thread 3lancer.eu

Hi,

> can anyone help me with this problem???

Yes. Two ideas.

1st, worse - use redirections, so in case your url is /searches/index?
search=linkin redirect it to /searches/index/linkin/. Redirections
always give us some overhead, also this way the search results won't
be seo.

2nd, better - you have to look thru $this->params to fetch all data
you need. ?search=linkin should be in $this->params['url']['search'].
You can fetch that from view or controller. So then, you can recode
SearchesController::index() to something like this:

function index($search = null) {
if (empty($search)) {
$search = @$this->params['url']['search'];
}
...
}

HTH,
Piotr
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Simple Question

2008-10-03 Thread MDB

Hello all, how do I get the selected value from a select drop down
box.  Basically I want to redirect based on the returned value however
I can not figure out how to get the selected value?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Passing arguments to "add" action

2008-10-03 Thread maciek

$this->passedArgs['patientId']
or
$this->passedArgs('patientId)

On Oct 2, 11:54 am, "jitka (poLK)" <[EMAIL PROTECTED]> wrote:
> debug($this->passedArgs);
>
> My point is - I do not think it is necessary to use named argument for
> your need.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



problem in cakephp

2008-10-03 Thread Mits

when i click on any link and immediately i click on other the cakephp
application redirects the application on login page.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Please help to create new multilanguage site in cake php

2008-10-03 Thread uddi

I have read the multilanguage support in cakePHP article (http://
bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-
internationalization-tutorial). But i am not able to run this example.

Please help if anyone have any other reference Url or guidence
material  from where i can get multilanguage support example having
step by step procedure.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How do i upload images using cakephp

2008-10-03 Thread AceStudio

I am developing a social community and would like members profile to
show their pictures or avatar. Cake documentation doesn't deal with
this at all. Please i'd appreciate if someone treated 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread Kappa

hi everybody,
I'm not a MVC guru,but in my opinion, the fact
that a view can import something and invoke
actions not performed by a controller, but from
a model, breaks somehow the MVC pattern.
Maybe if you need some action to manipulate data
of a model before display them, you should use
the afterfind of the model.

For example if you are handling Users, and you want
the full name with initials, but in the DB you have
name,surname and initials, you should put in after find
method something that bind together the 3 fields
and create a new key  $user['User']['fullname'].



Moreover since in your example you wrote this:

class Product extends AppModel {
 //... all attributes and methods

 function performSomeProductCalculation () {
   //perform business logic
   return $result;
 }

}

..the comment "PERFORM BUSINESS LOGIC" should immediately
let you think that something is not 100% MVC ..you are
performing LOGIC inside a MODEL, and not just model data
handling.

Anyway i don't want say that's wrong, but only that's not
100% MVC and in this way answering to your question.

Bye!!
  Andrea

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Notice (8): Undefined index: abc [APP\views\......\index.ctp

2008-10-03 Thread S/*\L/*\L/*\M

hi all,
i m very new in cakePHP, pls help me some one about this error, which
is headeach for me.
=> i m getting error of [Undefined index] in  abc view file.i m
pasting code here if some 1 got it then pls help me.
thanx

=>this controller file code for index...
function index() {
$this->Book->recursive = 1;
$books = $this->Book->find('all');
$this->set('books', $books);
}

=>and this one code for index.ctp







i am waiting :)

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Does calling model methods from elements break MVC pattern?

2008-10-03 Thread Kappa

hi everybody,
I'm not a MVC guru,but in my opinion, the fact
that a view can import something and invoke
actions not performed by a controller, but from
a model, breaks somehow the MVC pattern.
Maybe if you need some action to manipulate data
of a model before display them, you should use
the afterfind of the model.

For example if you are handling Users, and you want
the full name with initials, but in the DB you have
name,surname and initials, you should put in after find
method something that bind together the 3 fields
and create a new key  $user['User']['fullname'].



Moreover since in your example you wrote this:

class Product extends AppModel {
 //... all attributes and methods

 function performSomeProductCalculation () {
   //perform business logic
   return $result;
 }

}

..the comment "PERFORM BUSINESS LOGIC" should immediately
let you think that something is not 100% MVC ..you are
performing LOGIC inside a MODEL, and not just model data
handling.

Anyway i don't want say that's wrong, but only that's not
100% MVC and in this way answering to your question.

Bye!!
  Andrea

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Is there a way to get a slice of many tables?

2008-10-03 Thread Mingan

Or you can specify only the fields you're interested in via 'fields'
array. in Model::find()

On 3 Říj, 00:22, Steveston <[EMAIL PROTECTED]> wrote:
> For example: a typical university project, I have users, user_courses
> (for instructors), user_enrolls (for students), courses, events (each
> course have one or more events), groups (each event has one or more
> groups), group_members (each group has 1+ members), etc
>
> It is very common for me to get data from all of these tables. While I
> can set association in model to do this, it requires me to do
> associations in many tables and returned data will be large and
> contain lots of fields that I am not interested in.
>
> Is there a way to get a slice of all those tables?
>
> For exmaple:
>
> user_id=1
> user_name=joe
> enrolled course name
> group name
>
> etc.
>
> Thank you,

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



concern regarding pagination

2008-10-03 Thread harry

hello fiends,
i have a problem using pagination pls help me out.

the link shown on the url is different from that of the links shown on
the page nos.
what i mean to say is the links that i'm gettin whin i point the mouse
on the page is /searches/index/linkin/page:2

but when i search foe an entity from the searchbar the link changes
to :
http://localhost/searches/index?search=linkin

as these 2 links are not compatible so i am not able to access the 2nd
or  any other page
can anyone help me with this problem???
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: URL routing

2008-10-03 Thread Mathew

Router::connect('/users/:username',
array('controller'=>'users','action'=>'index'),array('pass'=>array('username')));

This routes /users/bobcostas to the function index( $username ) method
of the controller, with the username passed as a parameter.

Router::connect('/users/:username/:action',
array('controller'=>'users'),array('pass'=>array('username')));

This does the same as the above, but allows the action to be after the
username. For example; /users/bobcostas/edit would call function
edit( $username ) in the UsersController.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Documentation - Cakes bad side

2008-10-03 Thread ORCC

The only complain that I found in the API documentation, is that there
are not clear explanations about the parameters that a method expects
(usually as an array) or class attributes are not explained too.
Altought there is the source code; in many cases the source code
itself is the best documentation.

The cookbook I think is very terse and concise. It has some lacks of
content, but you can realize that the cookbook has a beta state too,
and obviously, it will be improved on time.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Release: CakePHP RC3 - The RC of Triumph!

2008-10-03 Thread Rajat Agarwal
Congratulation!! Core Team

On Fri, Oct 3, 2008 at 6:15 PM, tracyfloyd <[EMAIL PROTECTED]> wrote:

>
> Fantastic! You guys rule!
>  >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: hello cake lovers

2008-10-03 Thread Novice Programmer
I am also getting the same problem.  I want to paginate the search results
in a fashion that the search url can be bookmarked. but i am not able to do
so. The problem being that when the query is a get string, the submission to
the searches controller looks like
http://x.com/searches/index?q=mystring
but i am not able to do the pagination. Mainly because i am not able to
fetch q part on the second parameter. So the problem revolves around:

1. Fetching the get query string.
2. Pass it as url to the paginator->numbers.

Any help would be appreciated.

Thanks.

On Fri, Oct 3, 2008 at 1:46 PM, harry <[EMAIL PROTECTED]> wrote:

>
> till now what i've made is a searches controller. this controller is
> ment to search either a user or an entity in the database.
> the first line of my index action is
> function index($searchby = 'entity')
> this funct works fine if i have to search for an entity, but when i
> search for a user it shows me nothin
> ///ly when i change the funct index to
> function index($searchby = 'user')
> i can search users from db but not content.
> i consider it to be a problem in routing, but i can change the url
> from the view part easily.
> the problem which i am facing is that when i enter something in the
> searchbar the url changes to:
>http://localhost/searches/index?search=linkin
>
> and the url which i want to work on is:
>  /searches/index/entity and
> /searches/index/user
> can any one help me out with it
>
> pls
> >
>


-- 
Thanks & Regards,
Novice.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Changelog notes for 1.1.20 missing?

2008-10-03 Thread majna

Is there changelog notes for 1.1.20?
like: https://trac.cakephp.org/wiki/changelog/1.1.x.x

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Routing Images

2008-10-03 Thread majna

You don't need routing (Router) becouse webroot's files like images
are accessed by web server directly, not through cake.

you can create url to images in your views:
For dataset: 1172271600 mylocation mygallery 0001
$img_url = 'event/'.date(Y_m_d).'mylocation_mygallery_0001.jpg';
echo $html->image($img_url);


On Oct 3, 12:51 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Hey CakeGroup,
>
> I want to route my Images in a specific schema. Can i use the
> Route::connect function for this ?
> And where should i put the logic for this? In the Controller, Model
> oder View?
>
> The schema:
> /img/events/:date(Y_m_d)/:location_:gallery_:number_thumb.jpg
>
> For example the dataset is this:
> 1172271600 mylocation mygallery 0001
>
> then the result after routing would be
> img/event/2007_02_24/mylocation_mygallery_0001.jpg
> and for thumbnail
> img/event/2007_02_24/mylocation_mygallery_0001_thumb.jpg
>
> How would you realize this in cake conventions ?
>
> Best Regards
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Documentation - Cakes bad side

2008-10-03 Thread cronet

I think the book is on the right way. Think a half year back! Nearly
nothing was documented.

Now, evertime I search a feature I look at the proper sections of the
book.
If you need help about Formhelper, look at the Built-In Helpers
chapter. It is structured very well, and you find many things without
searching for it.




On Oct 2, 6:17 pm, mbavio <[EMAIL PROTECTED]> wrote:
> Maybe next time you can ask if the functionality is broken first, and
> avoid kabturek a headache :)
>
> Cheers.
> mbavio
>
> On Oct 2, 9:31 am, leberle <[EMAIL PROTECTED]> wrote:
>
> > Ohpsthat explains it...thx for the info :)
>
> > On Oct 2, 2:15 pm, "[EMAIL PROTECTED]"
>
> > <[EMAIL PROTECTED]> wrote:
> > > The search feature in the book is broken and under 
> > > repair:http://groups.google.com/group/cake-php/browse_thread/thread/18c4e419...
>
> > > On Oct 2, 11:48 am, leberle <[EMAIL PROTECTED]> wrote:
>
> > > > Well, i change my whining to "the book-search should be optimized"...
> > > > searching for "input" or "inputs" shows no results, as does
> > > > "formhelper"...
>
> > > > And there is no reason to be sad Marcin, we both got what we
> > > > expected...you expected trolling, i expected critic-resistant fans who
> > > > take critic as trolling, so everything is fine :)
>
> > > > I do my contribution to cake in #cakephp
>
> > > > >>There where many of your kind here before and they just wrote the same
>
> > > > ...dude, you REALLY should think about this sentence...all i said was,
> > > > that i think that melting API and Docs together would be very helpfull
> > > > as it is often hard to find infos about features. But if you prefer to
> > > > be mister documentation-is-perfect-only-idiots-dont-find-what-they-are-
> > > > looking-for, then farewell dude...
>
> > > > On Oct 2, 11:17 am, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
>
> > > > > im ashamed im always so easily provoked by trolls :)
> > > > > --
> > > > > Marcin Domanskihttp://kabturek.info
>
> > > > > On Thu, Oct 2, 2008 at 11:16 AM, Marcin Domanski <[EMAIL PROTECTED]> 
> > > > > wrote:
> > > > > > You expect right - what is complaining without helping ? useless 
> > > > > > whining...
> > > > > > here is your label 
> > > > > > :http://book.cakephp.org/view/189/Automagic-Form-Elements
> > > > > > Let me ask you this - when you learned about something that isnt
> > > > > > documented - did you update the book.cakephp.org with your findings 
> > > > > > ?
> > > > > > Don't expect much if you don't give anything...
> > > > > > There where many of your kind here before and they just wrote the 
> > > > > > same
> > > > > > as you and faded away... (you can search the group if you like)
>
> > > > > > --
> > > > > > Marcin Domanski
> > > > > >http://kabturek.info
>
> > > > > > On Thu, Oct 2, 2008 at 10:48 AM, leberle <[EMAIL PROTECTED]> wrote:
>
> > > > > >> Hey dudes,
>
> > > > > >> I've been playing around with cake for some time now, and i really
> > > > > >> like cake, its a brilliant framework.
> > > > > >> But Cakes weakness is the documentation. There are so many features
> > > > > >> that are not documented yetthis really has to change, 
> > > > > >> undocumented
> > > > > >> features are worthless features. Before cake, i was using 
> > > > > >> codeigniter.
> > > > > >> CI is small, but fast. AND: it is documented. I know about this 
> > > > > >> "CI is
> > > > > >> company driven shit"-talk, but at least you dont have to look in 
> > > > > >> the
> > > > > >> core every time you wanna use a feature.
>
> > > > > >> Well, as this is a fan-community i expect to get flamed now, but 
> > > > > >> all i
> > > > > >> wanna say is: cake needs better documentation. Melt the API-Refs 
> > > > > >> and
> > > > > >> the Docs together. Devs should not have to look in the core-source 
> > > > > >> to
> > > > > >> find out how features work (e.g.: how to change the fieldset-label
> > > > > >> when using the $formHelper->inputs(..) function...what i just did 
> > > > > >> - u
> > > > > >> can pass an association named 'legend' => 'your fieldset title' 
> > > > > >> along
> > > > > >> with the other, not associativ entries...as far as i can see: not
> > > > > >> documented..correct me if i'm wrong )
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Index / Url Error?

2008-10-03 Thread MDB

I am new to this, I just took over this site which was written in
cakephp and I have never seen or used it before.

On Oct 2, 8:54 pm, "3lancer.eu" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Well, I don't know why do you expect that to work. Please read the
> chapter on routes:http://book.cakephp.org/view/46/Routes-Configuration
>
> You would save some work if you followed cake url conventions.
>
> Regards,
> Piotr
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Routing Images

2008-10-03 Thread [EMAIL PROTECTED]

Hey CakeGroup,

I want to route my Images in a specific schema. Can i use the
Route::connect function for this ?
And where should i put the logic for this? In the Controller, Model
oder View?

The schema:
/img/events/:date(Y_m_d)/:location_:gallery_:number_thumb.jpg

For example the dataset is this:
1172271600 mylocation mygallery 0001

then the result after routing would be
img/event/2007_02_24/mylocation_mygallery_0001.jpg
and for thumbnail
img/event/2007_02_24/mylocation_mygallery_0001_thumb.jpg

How would you realize this in cake conventions ?

Best Regards
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Update problem in AclBehavior

2008-10-03 Thread lightglitch

Thx, for the info.

On Oct 2, 7:30 pm, mark_story <[EMAIL PROTECTED]> wrote:
> I don' think this is going to be changed before 1.2 is released but it
> is pretty easy to do in your models.
>
> http://mark-story.com/Posts/view/auth-and-acl-automatically-updating-...
>
> tutorial for doing it with users, follows along with the sample app in
> the cookbook.
>
> -Mark
>
> On Oct 2, 10:36 am, lightglitch <[EMAIL PROTECTED]> wrote:
>
> > When adding a record in a Model that acts as AclBehavior everything
> > works fine and a new record is created in the Aro/Aco table linked to
> > the previous one.
>
> > But when I update that same record and change the alias or the parent
> > the Arco/Aco record is not updated.
> > I have check the code and the afterSave method is only
> > implemented for inserts and not updates:
>
> >         function afterSave(&$model, $created) {
> >                 if ($created) {
> >                         $type = 
> > $this->__typeMaps[strtolower($this->settings[$model->name]
> > ['type'])];
> >                         $parent = $model->parentNode();
> >                         if (!empty($parent)) {
> >                                 $parent = $this->node($model, $parent);
> >                         } else {
> >                                 $parent = null;
> >                         }
>
> >                         $model->{$type}->create();
> >                         $model->{$type}->save(array(
> >                                 'parent_id'             => 
> > Set::extract($parent, "0.{$type}.id"),
> >                                 'model'                 => $model->name,
> >                                 'foreign_key'   => $model->id
> >                         ));
> >                 }
> >         }
>
> > There's something missing in the implementation or is suppose to be
> > like that?
> > Because the update would handy ...
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Promlems with Fixtures using $import in RC3

2008-10-03 Thread cdamian

I am having problems with fixtures which use $import = "SomeModel".

I am getting the usual "Database table some_models for model SomeModel
was not found."

Sometimes it helps to change it to $import = array('table' =>
'some_models'); but this doesn't solve it all the time. Especially if
there are multiple fixtures used in a test.

Did the way fixtures should be used change in RC3, the tests were
working in RC2 ? Or should I just stop using $import ?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Effect.Fade and Effect.Appear

2008-10-03 Thread Dinko

This is rather a Javascript problem, not Cake.

Have a look at
http://github.com/madrobby/scriptaculous/wikis/effect-appear
http://github.com/madrobby/scriptaculous/wikis/effect-fade

which should help you.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Any freelance jobs?

2008-10-03 Thread evert0n

thank you brendon

On Oct 1, 1:54 am, BrendonKoz <[EMAIL PROTECTED]> wrote:
> http://cakephp.org/jobshttp://withcake.com/
>
> On Sep 28, 4:33 am, evert0n <[EMAIL PROTECTED]> wrote:
>
> > Hi, guys anyone need a hand for cakephp projects?
>
> > I'm avaliable for any opportunities asfreelance.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to recode MySQL Boolean field to yes/no in a view

2008-10-03 Thread David C. Zentgraf

Over-engineer much? ;-)

echo $model['boolField'] ? 'Yes' : 'No';

On 3 Oct 2008, at 17:08, Kanten wrote:

>
> Hi,
>
> I have a MySQL table with lots of boolean fields (BOOL) and when
> viewing these in my view I would like to output "Yes" or "No" instead
> of "1" or "0".
>
> I have experimented a bit with doing stuff like this in my controller:
>
>   foreach (array_keys($data['BrugadaProfile']) as $key):
>   if ($data['BrugadaProfile'][$key] == 1 && ! 
> strpbrk($key, 'id'))
> { //Avoid recoding foreign key fields
>   $data['BrugadaProfile'][$key] = 'Yes';
>   } elseif ($data['BrugadaProfile'][$key] == 0 && ! 
> strpbrk($key,
> 'id')) {
>   $data['BrugadaProfile'][$key] = 'No';
>   }
>   endforeach;
>
> But this approach is obviously very error prone and I think the best
> way to go about it, is to somehow access the field type to check if
> its a boolean field and then recode it.
> How can this be done?
>
> /Anders
> >


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



hello cake lovers

2008-10-03 Thread harry

till now what i've made is a searches controller. this controller is
ment to search either a user or an entity in the database.
the first line of my index action is
function index($searchby = 'entity')
this funct works fine if i have to search for an entity, but when i
search for a user it shows me nothin
///ly when i change the funct index to
function index($searchby = 'user')
i can search users from db but not content.
i consider it to be a problem in routing, but i can change the url
from the view part easily.
the problem which i am facing is that when i enter something in the
searchbar the url changes to:
http://localhost/searches/index?search=linkin

and the url which i want to work on is:
 /searches/index/entity and
/searches/index/user
can any one help me out with it

pls
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



How to recode MySQL Boolean field to yes/no in a view

2008-10-03 Thread Kanten

Hi,

I have a MySQL table with lots of boolean fields (BOOL) and when
viewing these in my view I would like to output "Yes" or "No" instead
of "1" or "0".

I have experimented a bit with doing stuff like this in my controller:

foreach (array_keys($data['BrugadaProfile']) as $key):
if ($data['BrugadaProfile'][$key] == 1 && ! 
strpbrk($key, 'id'))
{ //Avoid recoding foreign key fields
$data['BrugadaProfile'][$key] = 'Yes';
} elseif ($data['BrugadaProfile'][$key] == 0 && ! 
strpbrk($key,
'id')) {
$data['BrugadaProfile'][$key] = 'No';
}
endforeach;

But this approach is obviously very error prone and I think the best
way to go about it, is to somehow access the field type to check if
its a boolean field and then recode it.
How can this be done?

/Anders
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---