Re: newbie syntax question for cake 1.2 RC1

2008-06-07 Thread .
thanks

what about Not Equals

I don't think  works anymore. What is it replaced by?

On Fri, Jun 6, 2008 at 2:57 AM, grigri [EMAIL PROTECTED] wrote:


 $this-Category-find('all', array(
  'conditions' = array(
'name LIKE' = '%'.$parent.'%',
'parent_id' = null
  )
 ));

 On Jun 6, 10:26 am, . [EMAIL PROTECTED] wrote:
  Hi
 
  I just switched from cake 1.2.6311 to cake 1.2.7125 (RC1)
 
  what is the new syntax for this command?
 
  $this-Category-findByName(array('name' ='LIKE %'.$parent.'%',
  'parent_id'=null));
 
  I want to find all categories where the name is like %parent% and the
  parent_id is null
 
  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
-~--~~~~--~~--~--~---



Select or text field depending on another select

2008-06-07 Thread dandreta

Hi,

I am doing searchs in my cake application. I have a select with
options and a text field. I want that if in this select is chosen
option 1 or option 2, the text field is kept to introduce the text to
search, but if the selected option is 3, I want that the text field is
replaced by another new select with 2 options.

Has anyone made something similar? How can I do that?

Thanks and 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: UTF8 vs Dreamweaver

2008-06-07 Thread David C. Zentgraf

On 7 Jun 2008, at 18:25, burzum wrote:

 It describes 41 steps (!!!) to arrange a form in two columns. The use
 of this gui is imo not less harder to learn then to read an article
 about css and columns and you're faster writing the code then using
 this editor ;)

Plus I will still want to comb through the generated HTML myself  
afterwards to weed out any superfluous tags or attributes these  
WYSIWYGs tend to insert.

Sorry, couldn't resist. EditorFlameWar over? ;o)

--~--~-~--~~~---~--~~
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 from 1.2 beta to rc leads to huge perfomance drop

2008-06-07 Thread [EMAIL PROTECTED]

I have noted the same thing of Hermann.
I use Xdebug and Wincachegrind.
And I have noted that the problem is exactly the presence of many
linked models in the application.
I'm a newbie in Cake but I think that a post about The Things to do
to get the best permorfance in cake could be useful for the person
like me.

On 7 Giu, 05:26, Dr. Tarique Sani [EMAIL PROTECTED] wrote:
 On Fri, Jun 6, 2008 at 6:06 PM, Hermann Wacker [EMAIL PROTECTED] wrote:

  What are the steps that one has to do for getting some descent
  performance out of cakephp? Where are the bottlenecks?

 If you are creating a sizable project and suffering performance issues the
 first thing to do is stop speculating about the bottlenecks and find them!

 Use Xdebug and Cachegrind to profile your application - you will then be
 able to pin point stuff from there on

 HTH

 Tarique

 --
 =
 Cheesecake-Photoblog:http://cheesecake-photoblog.org
 PHP for E-Biz:http://sanisoft.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
-~--~~~~--~~--~--~---



Re: ACL schema

2008-06-07 Thread aranworld

For some reason, I thought the AuthComponent used the username in it's
call to check but I can now see that in it's first parameter it is
using the array representing data from the User model.   For some
reason I thought that it used to use only the username alias?

On Jun 6, 12:30 pm, mbavio [EMAIL PROTECTED] wrote:
 Aran,

 I agree with your opinion about crud being cleaner, but, why do you
 say what only with:

 check('username', 'CamelCaseController', 'crudmappedaction');

 will work? You can use:

 check(array('model' = 'Model', 'foreign_key' = 'anID'),
 'CamelCaseController', 'crudmappedaction');

 and complement it with Acl Behavior, that not set Alias by default.

 Just my two cents.

 Cheers,
 mbavio

 On May 27, 11:29 am, aranworld [EMAIL PROTECTED] wrote:

  The Auth component has very specific rules for how it checks access.
  In 'actions' mode, it will do:
  check( 'username', 'CamelCaseController/action', *);

  In 'crud' mode it will do:
  check('username', 'CamelCaseController', 'crudmappedaction');

  In light of this, your schema looks like it is meant to go with
  'actions' mode and you would have to have a controller X with actions
  like approve_member, post_forum, remove_member, which sounds messy to
  me, becuase the controllers are starting to just become catch-all
  function repositories rather than Classes.

  One thing you could do is have acos like this and use 'crud' mode:

  ClubXForums
  ClubXMembers
  ClubYForums
  ClubYMembers
  ClubZForums
  ClubZMembers

  These would all map to controllers with the standard add, edit,
  delete, view, index actions.  However, they would actually all be
  empty controllers and would merely extend a more generic Forums and
  Members controller.

  So you have Tristan, who is a member of ClubX, but participates in the
  admin of ClubY:

  Acl-grant('Tristan', 'ClubXForums', array('read', 'create');
  Acl-grant('Tristan', 'ClubXMembers', array('read');
  Acl-grant('Tristan', 'ClubYForums', *);
  Acl-grant('Tristan', 'ClubYMembers', *);

  I have tried both crud and actions mode, and found that in the long
  run it is much easier to manage crud mode, due to the reduced number
  of ACO nodes.

  -Aran

  On May 27, 3:04 am, dmadruga [EMAIL PROTECTED] wrote:

   Hi folks!
   I'm trying to come up with a descent schema for the ACL of a tennis
   association website.
   Basically there are several tennis clubs, each club has several
   regular members and a committee of 3 to 5 members responsible for
   managing the club and accepting/rejecting new members. One person may
   be a member of several clubs, and may be in different positions in
   each one (for ex: Tom's a member of the club's X committee and a
   regular member of the club Y).
   The web system will centralize the management of all the clubs related
   to the association.
   A Guest will be allowed to sign up to the association and become a
   Member.
   A Member will be allowed to join a club.
   A Member of the committee will be allowed to edit information related
   to his club, approve/reject new members requests, among other
   operations.
   As soon as a new member is accepted to a club he'll be able to view
   information related to this club, post messages in the club's forum,
   and so on...

   The ACL schema that first came to my mind was something like this:

   _AROs_
   Admin (the group of site admins, those who will have full access to
   everything)
   Guests
   Members
   --- Bob
   --- Tom
   --- John

   _ACOs_
   create_account (maps to the create_account method in the users
   controller)
   join_club (maps to the join_club method in the clubs controller)
   club
   --- X
   --- --- view
   --- --- edit
   --- --- delete
   --- --- approve_member
   --- --- post_forum
   --- --- remove_member
   --- Y
   --- --- view
   --- --- edit
   ...
   --- --- remove_member
   --- Z
   ...

   (X, Y, and Z are the clubs).

   As far as I understood I'll be able to allow an specific user (say
   Bob) to perform an specific operation (say club/Y/approve_member).
   Am I wrong?
   Then, in the method that performs this operation I can check if Bob
   (the logged user) is allowed to perform the operation for the current
   club (say .../clubs/approve_member/club_id).
   Right?

   I also though about creating a different ARO group for each club, but
   the problem I found is that I can't associate a Member to more than
   one group. I could create a new ARO each time a member joins a club,
   but it seems to me more complex than the previous solution. Am I
   wrong?

   The last thing... I'm using the Auth component and I realized that it
   has a strong interaction with the ACL component. If I use this non-
   standard approach to construct my ACL will I mess Auth's work?

   Thanks a lot!!!
   Daniel Madruga.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, 

Re: Update from 1.2 beta to rc leads to huge perfomance drop

2008-06-07 Thread Dr. Tarique Sani
On Sat, Jun 7, 2008 at 5:36 PM, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:


 I have noted the same thing of Hermann.
 I use Xdebug and Wincachegrind.
 And I have noted that the problem is exactly the presence of many
 linked models in the application.


Great Start -  What you really mean that your application is running too
many un-needed queries and handling too much data.

The solution to this is using the Containable behavior see
http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/

I'm a newbie in Cake but I think that a post about The Things to do
 to get the best permorfance in cake could be useful for the person
 like me.


Not exactly in those words but there are posts about it out there and like
any other programming there can't be any one true solution for best
performance... you have to tailor your application accordingly

Perhaps you can write a post on how you optimized your application.

Cheers
Tarique

-- 
=
Cheesecake-Photoblog: http://cheesecake-photoblog.org
PHP for E-Biz: http://sanisoft.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
-~--~~~~--~~--~--~---



Dynamic Controller

2008-06-07 Thread stillboy

I would like to be able to have a single controller that handles other
controllers . Basically I want to be able to 'install' a controller
without modifying any files, so the 'installed' controller and views
would live as text in the database and be called on either via the
handlercontroller/installedcontroller/function/values or directly.

Anyone have any idea how I might go about doing this?

Thank you in advance!

~stillboy

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



Paginate with Containable

2008-06-07 Thread NappyHeaded

I'm having trouble figuring out how to pare down my queries with
Containable behavior when using paginate.

Basically, I am showing Post records, but I want the Topic name
(parent of Post) and Topic Group name (parent of Topic). If I do
recursive = 2, then I have 200 queries, so I would like something like
this (but this don't work):

$this-paginate = array(
'Post' = array(
'fields' = array(
'id', 'title', 'description', 'url', 'domain',
'recommendation_count', 'comment_count'
),
'contain' = array(
'Member' = array(
'fields' = array(
'id', 'username'
)
),
'Topic' = array(
'TopicGroup'
)
)
)
);
$posts = $this-paginate();

--~--~-~--~~~---~--~~
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: Keep current password

2008-06-07 Thread Dardo Sordi Bogado

I use a password_confirm, have setup the validations in the model to
check password == password_confirm and have this function in my user
model:

function beforeSave() {
if (!isset($this-data['User']['password_confirm']) ||
empty($this-data['User']['password_confirm'])) {
unset($this-data['User']['password']);
}
return true;
}

So, you don't save passwords if there isn't confirmation, and
confirmation == password is enforced at validation code.

Here is my complete user model: http://bin.cakephp.org/view/1208127933

Regards,
- Dardo Sordi.

On Fri, Jun 6, 2008 at 9:13 PM, b logica [EMAIL PROTECTED] wrote:

 Why not just remove the password field from the form and create a
 dedicated action/view for changing a password? Works for me.

 On Fri, Jun 6, 2008 at 5:15 PM, benjam [EMAIL PROTECTED] wrote:

 I don't think beforeSave would work, because it gets hashed even
 before the method that calls Save( ).

 I think I may have found a cheater (read: non-cake) way of doing it...

 I run the following test:

 if ($this-Auth-password('') == $this-data['User']['password']) {
unset($this-data['User']['password']);
 }

 Basically, if the hash matches the hash of an empty string, the
 password was empty... clear it. done.

 thanks for all the input though guys, I appreciate it.
 


 


--~--~-~--~~~---~--~~
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: UTF8 vs Dreamweaver

2008-06-07 Thread Marcin Domanski

 Sorry, couldn't resist. EditorFlameWar over? ;o)
It's never over!
Vim FTW!



-- 
Marcin Domanski
http://kabturek.info

--~--~-~--~~~---~--~~
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: Select or text field depending on another select

2008-06-07 Thread Dardo Sordi Bogado

 Has anyone made something similar? How can I do that?

JQuery?

 Thanks and 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 from 1.2 beta to rc leads to huge perfomance drop

2008-06-07 Thread John David Anderson

On Jun 7, 2008, at 8:18 AM, Femi Taiwo wrote:

 Hi,
 Here a quick 4-step primer to get better performance in cake

 1. Specify var $recursive = 0; in your app/app_model.php
 This will cut off all automatic calls to hasMany haBtm  
 relationships by default. three-quarters of the time, I don't want  
 those results - I simply need the belongsTo bindings.

 2. Use the Containable behavior 
 http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/
 With that you can easily set the models to pull, the level of  
 recursion..

 3. Use Wincachegrind and Xdebug to test after.

 4. Avoid using so many App::import('Model',$modelName) in your  
 components where possible.

I've also seen a jump when I put the rewrite instructions in my apache  
config rather than the .htaccess file.

-- John







 Dr. Tarique Sani wrote:

 On Sat, Jun 7, 2008 at 5:36 PM, [EMAIL PROTECTED] [EMAIL PROTECTED] 
  wrote:

 I have noted the same thing of Hermann.
 I use Xdebug and Wincachegrind.
 And I have noted that the problem is exactly the presence of many
 linked models in the application.

 Great Start -  What you really mean that your application is  
 running too many un-needed queries and handling too much data.

 The solution to this is using the Containable behavior see 
 http://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/

 I'm a newbie in Cake but I think that a post about The Things to do
 to get the best permorfance in cake could be useful for the person
 like me.

 Not exactly in those words but there are posts about it out there  
 and like any other programming there can't be any one true solution  
 for best performance... you have to tailor your application  
 accordingly

 Perhaps you can write a post on how you optimized your application.

 Cheers
 Tarique

 -- 
 =
 Cheesecake-Photoblog: http://cheesecake-photoblog.org
 PHP for E-Biz: http://sanisoft.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
-~--~~~~--~~--~--~---



Re: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread Marcin Domanski

Hey
 would you consider it acceptable to break strict mode in a few key
 (forward-compatible) areas if it meant significantly simplifying code
 and/or eliminating extra work you would otherwise have to do?
it's like with piggy banks - you know you'll find some reward in there
but it's still breaking  a nice piggy ;)

 As a
 feature, how important is absolute compliance with strict-mode
 standards?
strict is about using the newest  greatest code available - IMO its
not necessary to write all code that is strict compliant (vendor
libraries are a pain) but I would prefer to maintain code that is
strict - that would show the maturity of both php and cakephp.

greets,

-- 
Marcin Domanski
http://kabturek.info

--~--~-~--~~~---~--~~
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 from 1.2 beta to rc leads to huge perfomance drop

2008-06-07 Thread gbk *

hi,

could you post an example about it? i would like to try it, but
unfortunately i'm not an apache expert.

thanks,

gbk

On Jun 7, 4:29 pm, John David Anderson [EMAIL PROTECTED]
wrote:
 On Jun 7, 2008, at 8:18 AM, Femi Taiwo wrote:



  Hi,
  Here a quick 4-step primer to get better performance in cake

  1. Specify var $recursive = 0; in your app/app_model.php
  This will cut off all automatic calls to hasMany haBtm
  relationships by default. three-quarters of the time, I don't want
  those results - I simply need the belongsTo bindings.

  2. Use the Containable 
  behaviorhttp://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/
  With that you can easily set the models to pull, the level of
  recursion..

  3. Use Wincachegrind and Xdebug to test after.

  4. Avoid using so many App::import('Model',$modelName) in your
  components where possible.

 I've also seen a jump when I put the rewrite instructions in my apache
 config rather than the .htaccess file.

 -- John

  Dr. Tarique Sani wrote:

  On Sat, Jun 7, 2008 at 5:36 PM, [EMAIL PROTECTED] [EMAIL PROTECTED]
   wrote:

  I have noted the same thing of Hermann.
  I use Xdebug and Wincachegrind.
  And I have noted that the problem is exactly the presence of many
  linked models in the application.

  Great Start -  What you really mean that your application is
  running too many un-needed queries and handling too much data.

  The solution to this is using the Containable behavior 
  seehttp://cakebaker.42dh.com/2008/05/18/new-core-behavior-containable/

  I'm a newbie in Cake but I think that a post about The Things to do
  to get the best permorfance in cake could be useful for the person
  like me.

  Not exactly in those words but there are posts about it out there
  and like any other programming there can't be any one true solution
  for best performance... you have to tailor your application
  accordingly

  Perhaps you can write a post on how you optimized your application.

  Cheers
  Tarique

  --
  =
  Cheesecake-Photoblog:http://cheesecake-photoblog.org
  PHP for E-Biz:http://sanisoft.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
-~--~~~~--~~--~--~---



Re: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread Dardo Sordi Bogado

 Now, rather than give specifics and turn this into a discussion about
 semantics, I've decided to pose this as a general question, which we
 can use as a guideline moving forward: assuming we follow the spirit
 of the law in all other areas (i.e. using proper visibility modifiers
 in classes, cleaning up object handling to comply with PHP5, etc.),
 would you consider it acceptable to break strict mode in a few key
 (forward-compatible) areas if it meant significantly simplifying code
 and/or eliminating extra work you would otherwise have to do?  As a
 feature, how important is absolute compliance with strict-mode
 standards?

I don't see strict mode compliance as a matter of live or death, but as you
are not giving details on were you are planing to break it is like
signing a blank check...

But I don't care, just continue building the greatest PHP framework ever!

Cheers,
- Dardo Sordi.

--~--~-~--~~~---~--~~
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: Paginate with Containable

2008-06-07 Thread Dardo Sordi Bogado

Open cake/tests/cases/libs/model/behaviors/containable.test.php, and
look for the testPaginate() function.

On Sat, Jun 7, 2008 at 4:43 AM, NappyHeaded
[EMAIL PROTECTED] wrote:

 I'm having trouble figuring out how to pare down my queries with
 Containable behavior when using paginate.

 Basically, I am showing Post records, but I want the Topic name
 (parent of Post) and Topic Group name (parent of Topic). If I do
 recursive = 2, then I have 200 queries, so I would like something like
 this (but this don't work):

 $this-paginate = array(
'Post' = array(
'fields' = array(
'id', 'title', 'description', 'url', 'domain',
 'recommendation_count', 'comment_count'
),
'contain' = array(
'Member' = array(
'fields' = array(
'id', 'username'
)
),
'Topic' = array(
'TopicGroup'
)
)
)
 );
 $posts = $this-paginate();

 


--~--~-~--~~~---~--~~
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: Dynamic Controller

2008-06-07 Thread stillboy

Ok, I think using routes I may be able to accomplish this. Can anyone
tell me what will happen with this route:

Router::connect('/*', array('controller' = 'plugins', 'action' =
'subdispatch'));

From what I understand, then everything will match to that - or should
that line -the /* definitely not happen?

~stillboy

On Jun 7, 7:43 am, stillboy [EMAIL PROTECTED] wrote:
 I would like to be able to have a single controller that handles other
 controllers . Basically I want to be able to 'install' a controller
 without modifying any files, so the 'installed' controller and views
 would live as text in the database and be called on either via the
 handlercontroller/installedcontroller/function/values or directly.

 Anyone have any idea how I might go about doing this?

 Thank you in advance!

 ~stillboy

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



Router + form + edit

2008-06-07 Thread Loic

Hello,

I've found a little problem in cake and I don't know if it's me doing
something bad ?

I have a route like this :
Router::connect('/:project/:controller/:action/
*',array(),array('pass'=array('project')));

It's work just fine, when I do a link like this
$html-link('Edit Milestone', array('action'='edit', 'project' =
$projectId, $milestone['Milestone']['id'])); ?
I get a url like : /1/milestones/edit/5

For the form, i could get the right action by adding url param :
?php echo $form-create('Milestone', array('url' = array('project'
= $projectId)));?
I get a form tag like this : form id=MilestoneAddForm method=post
action=/~loic/trek/1/milestones/add

But, when I use the same thing for edit form, I get this :
form id=MilestoneEditForm method=post action=/~loic/trek/
milestones/edit/1/project:1

I have found one similar bug, but with admin url's. He is now
fixed : https://trac.cakephp.org/ticket/3108
If anyone knowwhat I did wrong, of if I should report this bug, please
let me know

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: Keep current password

2008-06-07 Thread Timmy Crawford

To get around the same issue, I created a checkbox field on my user
form when $id  0.  Name the field change_password or something like
that, and then you can roll your logic based off that field value
wether or not to change the password field.

On Jun 6, 1:33 pm, benjam [EMAIL PROTECTED] wrote:
 I have an admin section to my site, which is protected by Auth and
 using a Users table.

 The trouble I'm having is, when I set up a user, everything works just
 fine.

 When I go in to edit that user, the password field gets corrupted
 because instead of re-hashing the original password (which would be
 impossible because it doesn't know it, unless it is specifically re-
 entered in the password field), it hashes the hash that is output by
 the form (the one stored in the database).

 I was wondering if there was a way to prevent it from hashing the
 password if there is no password entered?

 Here is what I have so far...

 in my model: (not complete)
 
 var $validate = array(
 'username' = array('alphaNumeric'),
 'email' = array('email'),
 'password' = VALID_NOT_EMPTY,
 );
 

 in my controller: (not complete)
 
 function admin_edit($id = null) {
 if (!$id  empty($this-data)) {
 $this-Session-setFlash(__('Invalid User', true));
 $this-redirect(array('action'='index'));
 }
 if (!empty($this-data)) {
 if (empty($this-data['User']['password'])) {
 unset($this-data['User']['password']);
 }
 if ($this-User-save($this-data)) {
 $this-Session-setFlash(__('The User has 
 been saved', true));
 $this-redirect(array('action'='index'));
 } else {
 $this-Session-setFlash(__('The User could 
 not be saved. Please,
 try again.', true));
 }
 }
 if (empty($this-data)) {
 $this-data = $this-User-read(null, $id);
 }
 }
 

 in my view: (not complete)
 
 ?php
 echo $form-input('username');
 echo $form-input('email');
 echo 'span class=infoLeave Password field blank to keep 
 current
 password/span';
 echo $form-input('password', array('value' = ''));
 echo $form-input('contact');
 echo $form-input('active');
 ?
 

 When I debug output $this-data right after I clear out an empty
 password field in the controller, it shows a hash in the password
 field, which means the data gets hashed before it gets to the
 controller admin_edit method.

 Where should I put the condition to clear out the password field if
 it's empty so that I can keep the current password if none is entered
 in the edit form?

 And how can I make sure that when adding a user, a password is
 required, but when editing a user, it is not?

--~--~-~--~~~---~--~~
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: TreeBehavior and callbacks

2008-06-07 Thread biesbjerg

Hi grigri,

thanks for your feedback.

I get what you're saying, but is it just me or does it seem wrong to
corrupt the tree, even though we fix it again (re-sync it)?

On Jun 5, 5:09 pm, grigri [EMAIL PROTECTED] wrote:
  Then the children will not get deleted and I'll end up with orphans..

 Really? I admit I don't use the TreeBehavior, but I am familiar with
 MPTT hierarchies, and I've got the code in front of me.

 I might well be wrong, but it seems like this:

 With the above code:

 1. You call Asset::del(id), maps to Model::del();
 2. Upload::beforeDelete() is called, file is deleted (id)
 3. Tree::beforeDelete() is called with id, Tree:deleteAll() is
 called (once) for all descendants of id (not just direct children)
 4. Tree::deleteAll() detaches Tree behavior
 5. Tree::deleteAll() calls Model::deleteAll() with cascade and
 callbacks
 6. Model::deleteAll() performs a find('all') - retrieving the ids of
 all the descendants, calls Asset::del() on each descendant (maps to
 Model::del())
 7. [each descendant] Model::del() calls Asset::beforeDelete, file is
 deleted
 (Tree::beforeDelete() is not called because it's still detached)
 8. Tree::deleteAll() re-attaches Tree behavior and exits
 9. Upload::beforeDelete re-syncs the tree
 10. rest of Asset::del(id)

 I could be completely wrong here, but looking at the code it seems to
 me this is how it would play out.
--~--~-~--~~~---~--~~
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: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread Gwoo

The blank check metaphor is excellent. It can be a very slippery slope
when heading down the path of non-strict compliance. If we understand
the hazards and take precautions hopefully we can prevent sliding down
too far.

As far as what Nate is getting at, I think I understand him correctly
when I say that the need to move outside of strict mode comes with the
Models. Basically, if we do not comply with strict mode, we can call
models statically, with late bindings and without the need for a
separate Record class for handling data results as objects.

To put it in code, and based on some initial testing we should be able
to do:
$post = Post::create();
$post-title = This is cool;
Post::save();

This violates strict mode because you are calling static methods on a
non static class.
Anyway, this is the best I can do to explain the scenario we have
encountered so far. Bottom line is..we do want the best framework. To
us, that means code that is cleaner and simpler. Sometimes the
benefits of such ease outweigh the costs of being completely
compliant. To be honest, I do not know 100% the inner workings of php.
My fear is that php could change and we would end up with unexpected
behavior. Also, while I do not support labels, being strict means
being enterprise ready. For the average developer this is not a
problem, but for larger companies looking to adopt Cake this is a
valid concern for the same reasons as the slippery slope.

There are more questions...How important is static access to models?
Should we just create instances as we do now? Would you prefer the
global access that a static class would provide?

Hope this helps the discussion. I look forward to more opinions on how
people see the use of CakePHP evolving.

Bake on.


--~--~-~--~~~---~--~~
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: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread aranworld

Sometimes us programmers not on the CakePHP development team will
think that we have an improvement to the core code, so we come up with
our own solution (hack) to improve things.  But then inevitably the
core code gets changed, and we suddenly find out that our hack is
broken, or just didn't make sense in the context of the future
direction of the Cake core.

This is why I think it might be hazardous to not use strict.
Presumably certain rules are in place, because the people who live and
breath the PHP core code have a good idea about where things are going
and they are trying to signal to us how to do things properly so that
they match where they are going and don't break with future versions.


On Jun 7, 10:26 am, Gwoo [EMAIL PROTECTED] wrote:
 The blank check metaphor is excellent. It can be a very slippery slope
 when heading down the path of non-strict compliance. If we understand
 the hazards and take precautions hopefully we can prevent sliding down
 too far.

 As far as what Nate is getting at, I think I understand him correctly
 when I say that the need to move outside of strict mode comes with the
 Models. Basically, if we do not comply with strict mode, we can call
 models statically, with late bindings and without the need for a
 separate Record class for handling data results as objects.

 To put it in code, and based on some initial testing we should be able
 to do:
 $post = Post::create();
 $post-title = This is cool;
 Post::save();

 This violates strict mode because you are calling static methods on a
 non static class.
 Anyway, this is the best I can do to explain the scenario we have
 encountered so far. Bottom line is..we do want the best framework. To
 us, that means code that is cleaner and simpler. Sometimes the
 benefits of such ease outweigh the costs of being completely
 compliant. To be honest, I do not know 100% the inner workings of php.
 My fear is that php could change and we would end up with unexpected
 behavior. Also, while I do not support labels, being strict means
 being enterprise ready. For the average developer this is not a
 problem, but for larger companies looking to adopt Cake this is a
 valid concern for the same reasons as the slippery slope.

 There are more questions...How important is static access to models?
 Should we just create instances as we do now? Would you prefer the
 global access that a static class would provide?

 Hope this helps the discussion. I look forward to more opinions on how
 people see the use of CakePHP evolving.

 Bake on.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



CustomQuery with Pagination

2008-06-07 Thread chaunceyt

Hello,

I had been looking for a pagination solution that I could use when I
needed to write a custom queries using CakePhp as the framework. I did
a lot of google searching and looked at a number of examples. However,
I couldn't find the solution I needed.

Looking at the cakeapps in the wild page and noticed phtagr. Checked
out the demo and noticed that it wasn't using the native cakephp
pagination.

I started reading and hacking and ended up with a solution based on
that code and wanted to share.

Download it from here: http://mashupkeyword.com/blog/?p=23

HTH

Thanks

P.S. if it helps you say Thanks to Sebastian Felis who developed
phtagr.

--
Chauncey Thorn
PHP Developer/Systems Administrator
email: [EMAIL PROTECTED]
url: http://www.cthorn.com/
url: http://www.mashupkeyword.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
-~--~~~~--~~--~--~---



Re: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread djiize

I read somewhere that from PHP6, E_STRICT will be merged in E_ALL
If you drop PHP4 support, be ready for PHP6 support ;)

Personally, I usually follow core dev rules for Cake, and it's the
same thing for PHP. They have Strict mode, so I try to have strict
compliant code.

As Aranworld said, if each brick we use has hacks (not the real
word, but close to my thought), the wall won't be strong.

On 7 juin, 20:38, aranworld [EMAIL PROTECTED] wrote:
 Sometimes us programmers not on the CakePHP development team will
 think that we have an improvement to the core code, so we come up with
 our own solution (hack) to improve things.  But then inevitably the
 core code gets changed, and we suddenly find out that our hack is
 broken, or just didn't make sense in the context of the future
 direction of the Cake core.

 This is why I think it might be hazardous to not use strict.
 Presumably certain rules are in place, because the people who live and
 breath the PHP core code have a good idea about where things are going
 and they are trying to signal to us how to do things properly so that
 they match where they are going and don't break with future versions.

 On Jun 7, 10:26 am, Gwoo [EMAIL PROTECTED] wrote:

  The blank check metaphor is excellent. It can be a very slippery slope
  when heading down the path of non-strict compliance. If we understand
  the hazards and take precautions hopefully we can prevent sliding down
  too far.

  As far as what Nate is getting at, I think I understand him correctly
  when I say that the need to move outside of strict mode comes with the
  Models. Basically, if we do not comply with strict mode, we can call
  models statically, with late bindings and without the need for a
  separate Record class for handling data results as objects.

  To put it in code, and based on some initial testing we should be able
  to do:
  $post = Post::create();
  $post-title = This is cool;
  Post::save();

  This violates strict mode because you are calling static methods on a
  non static class.
  Anyway, this is the best I can do to explain the scenario we have
  encountered so far. Bottom line is..we do want the best framework. To
  us, that means code that is cleaner and simpler. Sometimes the
  benefits of such ease outweigh the costs of being completely
  compliant. To be honest, I do not know 100% the inner workings of php.
  My fear is that php could change and we would end up with unexpected
  behavior. Also, while I do not support labels, being strict means
  being enterprise ready. For the average developer this is not a
  problem, but for larger companies looking to adopt Cake this is a
  valid concern for the same reasons as the slippery slope.

  There are more questions...How important is static access to models?
  Should we just create instances as we do now? Would you prefer the
  global access that a static class would provide?

  Hope this helps the discussion. I look forward to more opinions on how
  people see the use of CakePHP evolving.

  Bake on.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Deleting dependent models with conditions

2008-06-07 Thread floob

Has anyone ever deleted from a Model that has dependent joins with
conditions, and realized that more rows got deleted than they
expected?

To give an example, let's declare 3 classes, Book Cd and
OverallFavorite.  OverallFavorite stores your prioritized rank of all
of your favorite stuff ... favorite book, cd, bike, framework,
whatever.  So, since we're joining many models to a single model, in
addition to a foreign key ID, the OverallFavorite model ALSO needs to
store which table that ID is references (classic compound key
situation).

The Book class would look like:

Book extends AppModel{
   ...
   var $hasOne = array('OverallFavorite' = array('foreignKey' =
'model_id', 'dependent' = true, 'conditions' =
'OverallFavorite.model_type = Book' );
   ...
}

What happens is, if you delete a book entry, the conditions aren't
being used.  EVERY row in OverallFavorite with the same foreignKey id
gets deleted.  If you have Cd, Book, and Framework, all with id=1 in
their tables, all three of those entries are deleted.

I ran into this yesterday, almost wrote up a new ticket ticket, and
found a 4-month old bug that was closed (not solved) with the
identical description.  I tacked on a test case to push that ticket
along, but I'm still curious about this bug.  So, my questions are:
Has anyone else had this problem before?  Is anyone EXPECTING this
delete-happy behavior to happen?  Is there some other understood
workaround for this?

Thanks all,
--~--~-~--~~~---~--~~
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: Deleting dependent models with conditions

2008-06-07 Thread floob

Almost forgot ... here's the link to the ticket: 
https://trac.cakephp.org/ticket/4202

On Jun 7, 1:42 pm, floob [EMAIL PROTECTED] wrote:
 Has anyone ever deleted from a Model that has dependent joins with
 conditions, and realized that more rows got deleted than they
 expected?

 To give an example, let's declare 3 classes, Book Cd and
 OverallFavorite.  OverallFavorite stores your prioritized rank of all
 of your favorite stuff ... favorite book, cd, bike, framework,
 whatever.  So, since we're joining many models to a single model, in
 addition to a foreign key ID, the OverallFavorite model ALSO needs to
 store which table that ID is references (classic compound key
 situation).

 The Book class would look like:

 Book extends AppModel{
...
var $hasOne = array('OverallFavorite' = array('foreignKey' =
 'model_id', 'dependent' = true, 'conditions' =
 'OverallFavorite.model_type = Book' );
...

 }

 What happens is, if you delete a book entry, the conditions aren't
 being used.  EVERY row in OverallFavorite with the same foreignKey id
 gets deleted.  If you have Cd, Book, and Framework, all with id=1 in
 their tables, all three of those entries are deleted.

 I ran into this yesterday, almost wrote up a new ticket ticket, and
 found a 4-month old bug that was closed (not solved) with the
 identical description.  I tacked on a test case to push that ticket
 along, but I'm still curious about this bug.  So, my questions are:
 Has anyone else had this problem before?  Is anyone EXPECTING this
 delete-happy behavior to happen?  Is there some other understood
 workaround for this?

 Thanks all,
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



dynamic variable names?

2008-06-07 Thread Dave

Hi guys,

first post :)

my question: is it possible to have dynamic variable names, I mean
something like this:

for($i=0;$ix;$i++){
$y_$i = blabla;
}

in other words I want the number of the loop to be displayer in the
name of the variable.

Thanks for help.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Proper debugging of CakePHP

2008-06-07 Thread littlewoodEd

I respectfully disagree.  I also have XDebug working with eclipse and
PDT.  I also can set a breakpoint in index.php.  I am unable to figure
out how to get execution to break in a controller.  I've come across
other threads in this group where folks are describing the same
problem, but no one has answered the question.

Is anyone out there successfully single-stepping through controller
code?
thanks,
--ed

On Jun 6, 9:45 am, Chris Hartjes [EMAIL PROTECTED] wrote:
 On Fri, Jun 6, 2008 at 9:43 AM, Sake [EMAIL PROTECTED] wrote:

  ok, so do I run the debugger on the index.php file? How does it work?

 You're going off-topic from Cake and into the Land of Debugging.
 Please use Google or your other favourite search engine to find info
 on how to useXDebugor any other debugging tools.

 --
 Chris Hartjes
 Internet Loudmouth
 Motto for 2008: Moving from herding elephants to handling snakes...
 @TheKeyBoard:http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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: dynamic variable names?

2008-06-07 Thread Simon COURTOIS

Dave wrote On 06/07/2008 09:54 PM:
 Hi guys,

 first post :)

 my question: is it possible to have dynamic variable names, I mean
 something like this:

 for($i=0;$ix;$i++){
 $y_$i = blabla;
 }

 in other words I want the number of the loop to be displayer in the
 name of the variable.

 Thanks for help
Hi,

You can test this syntax :

$y = 'test';

for($i=0; $i  3; $i++)
{
   ${$y.'_'.$i} = 'blabla';
}

echo $test_0;

it should echo : blabla

voila :)

-- 
Simon COURTOIS
{EPITECH.} tek4 | (LINAGORA) Developer | [ADITAM] Project Manager
10, rue Brillat-Savarin 75013 Paris | 01 45 42 72 30 - 06 72 44 67 81
http://www.happynoff.fr


--~--~-~--~~~---~--~~
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: dynamic variable names?

2008-06-07 Thread HappyNoff

On Jun 7, 9:54 pm, Dave [EMAIL PROTECTED] wrote:
 Hi guys,

 first post :)

 my question: is it possible to have dynamic variable names, I mean
 something like this:

 for($i=0;$ix;$i++){
 $y_$i = blabla;

 }

 in other words I want the number of the loop to be displayer in the
 name of the variable.

 Thanks for help.

Hi,

You can test this syntax :

$y = 'test';

for($i=0; $i  3; $i++)
{
  ${$y.'_'.$i} = 'blabla';
}

echo $test_0;

it should echo : blabla

voila :)

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



custom routes and pagination (how I did it)

2008-06-07 Thread b logica

cake_1.2.x.x_6590

I'd been writing this cry for help when I suddenly had one more idea
to try ... and it works! Rather than delete this I thought it might
come in useful to someone else. And, if anyone cares to point out
something I've missed, or simply a better way to handle this, please
do let me know.

I have a view with a list of links, a, b, c, ...  that are used to
place a find condition on last name. The controller is Artists but all
of the access to it is through custom routes because it's a
multilingual site. Some of my routes actually use regexp lists of
several words to match for a single controller but, in this case, it's
just a single word, 'repertoire', that the client really wants. So,
here are the index() routes:

Router::connect('/repertoire', array('controller' = 'artists',
'action' = 'index'));
Router::connect('/repertoire/index/*', array('controller' =
'artists', 'action' = 'index'));
Router::connect('/repertoire/:letter/*',
array('controller' = 'artists', 'action' = 'index'),
array('letter' = '[a-z]{1}')
);

The 2nd route here was necessary to get pagination working with a
general find().

I'd originally had the 3rd route pointing to findByLetter() but
pagination wouldn't work with that and, as i'm just rendering the
index view anyway, i thought i'd try to send it to index() instead. If
'letter' is available in params that is used, otherwise, all artists
are fetched.

Unfortunately, the pagination links always look like, eg:

/repertoire/index/page:2

I wanted the helper to tell Router to write them like, eg:

/repertoire/b/page:2

I tried playing with $paginator-options['url'] but giving it a string
always result in that string being appended to '/repertoire/index'.
Passing an array with controller/action didn't make sense because I'm
using a custom route (and this is where the Aha! moment came).

What i did was place the following in my view:

if (isset($letter))
{
$paginator-options['url'] = array('controller' = 'repertoire',
'action' = $letter);
}

Gadzooks! It works!

--~--~-~--~~~---~--~~
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: CustomQuery with Pagination

2008-06-07 Thread Marcin Domanski

hey,

 I had been looking for a pagination solution that I could use when I
 needed to write a custom queries using CakePhp as the framework. I did
 a lot of google searching and looked at a number of examples. However,
 I couldn't find the solution I needed.
When you look at the controller source[1] - paginate method you will
see on lines 991 and 1008 that it looks for functons paginate() and
paginateCount() in the object(model) that you want to paginate. just
create these functions in the model with your custom logic.

[1] 
http://api.cakephp.org/1.2/libs_2controller_2controller_8php-source.html#l00887




-- 
Marcin Domanski
http://kabturek.info

--~--~-~--~~~---~--~~
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: dynamic variable names?

2008-06-07 Thread b logica

You could add dynamic keys  values to an array. Then just extract() the array:

$a_vars = array();

for ($i = 0; $i  $x; $i++)
{
$a_vars[foo_${i}] = bar_${i};
}

extract($a_vars);

You now have variables $foo_0, $foo_1, .. $foo_[x-1] available.



On Sat, Jun 7, 2008 at 3:54 PM, Dave [EMAIL PROTECTED] wrote:

 Hi guys,

 first post :)

 my question: is it possible to have dynamic variable names, I mean
 something like this:

 for($i=0;$ix;$i++){
 $y_$i = blabla;
 }

 in other words I want the number of the loop to be displayer in the
 name of the variable.

 Thanks for help.

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Update from 1.2 beta to rc leads to huge perfomance drop

2008-06-07 Thread keymaster


 today I upgraded to 1.2 RC1 ... and now I have minimum 1 second runtime
 and even worse: this goes sometimes up to 2 seconds execution time

Hermann,

I don't understand what you are asking for.

Are you claiming 1.2 RC has dropped in performance relative to 1.2
beta, for the same application ?

Or, are you just asking for general cake performance tips ?


--~--~-~--~~~---~--~~
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: Proper debugging of CakePHP

2008-06-07 Thread Chowsapal

To get the execution to break in a controller, you need to either:

1) set a break point in the particular controller action you're trying
to debug,

or 2) make sure to step into $Dispatcher-dispatch($url) (line 82 for
my version of Cake), then into return $this-_invoke (my line 246 in
dispatcher.php), then call_user_func_array (my line 264 in
dispatcher.php) should take you into your code.

Mind you, I'm using XDebug in vim to do this, but I would be shocked
if Eclipse's version didn't support this.

On Jun 7, 4:53 pm, littlewoodEd [EMAIL PROTECTED] wrote:
 I respectfully disagree.  I also have XDebug working with eclipse and
 PDT.  I also can set a breakpoint in index.php.  I am unable to figure
 out how to get execution to break in a controller.  I've come across
 other threads in this group where folks are describing the same
 problem, but no one has answered the question.

 Is anyone out there successfully single-stepping through controller
 code?
 thanks,
 --ed

 On Jun 6, 9:45 am, Chris Hartjes [EMAIL PROTECTED] wrote:

  On Fri, Jun 6, 2008 at 9:43 AM, Sake [EMAIL PROTECTED] wrote:

   ok, so do I run the debugger on the index.php file? How does it work?

  You're going off-topic from Cake and into the Land of Debugging.
  Please use Google or your other favourite search engine to find info
  on how to useXDebugor any other debugging tools.

  --
  Chris Hartjes
  Internet Loudmouth
  Motto for 2008: Moving from herding elephants to handling snakes...
  @TheKeyBoard:http://www.littlehart.net/atthekeyboard


--~--~-~--~~~---~--~~
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: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread keymaster

I think the strategic benefit of remaining compliant outweighs a cheap
high of looking pretty.

 the people who live and breath the PHP core code have a good  idea about 
 where things are going and they are trying to signal
 to us how to do things properly so that they match where they
 are going and don't break with future versions.

Well said.

Better to work with the system than try to be mavericks.
--~--~-~--~~~---~--~~
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: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread keymaster

I think the strategic benefit of remaining compliant outweighs the
quick
high of looking pretty.

 the people who live and breath the PHP core code have a good
 idea about where things are going and they are trying to signal
 to us how to do things properly.

Well said.

 being strict means being enterprise ready. For the average developer this 
 is not a
 problem, but for larger companies looking to adopt Cake this is a valid 
 concern.

Agreed.

Better to work with the system.
--~--~-~--~~~---~--~~
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: Misconfigured CSS Directory

2008-06-07 Thread spamguy

In the end it was the absence of .htaccess files. Those files don't
even show up in UNIX when 'ls dir' is called, so I panicked a
little. This blog post turned out to be my saviour, and I recommend it
to all who have similar problems:
http://www.ninjavspenguin.com/blog/2007/01/21/cakephp-install-multiple-subdirectories-500-error/

On Jun 5, 3:15 am, Grant Cox [EMAIL PROTECTED] wrote:
 /css/cake.generic.css is correct - you should never see the webroot
 in the url

 If mod_rewrite is enabled, are you sure you haven't removed
 any .htaccessfiles?
 If mod rewrite is disabled, are you sure you haven't removed any
 index.php files?

 if you have
 /var/www/html/cake/app/webroot

 then there should also be
 /var/www/html/cake/.htaccess
 /var/www/html/cake/app/.htaccess
 /var/www/html/cake/app/webroot/.htaccess

 plus index.php files in each of those locations too.

 On Jun 5, 7:17 am, spamguy [EMAIL PROTECTED] wrote:

  I am running Cake 1.2 and just got my first test app running. By 'test
  app,' I mean basically the factory web page with a line or two of PHP
  to make sure everything's wired.

  If I visithttp://localhost/appname, I get /webroot without CSS
  styling. Studying the source makes the reason obvious:
  CakePHP seems to be looking for CSS in the wrong place. It accesses
  appname/css/cake.generic.css (which doesn't exist) instead of
  appname/webroot/css/cake.generic.css.

  I've already seen the same topic 
  athttp://groups.google.com/group/cake-php/browse_thread/thread/b80f8013...
  , but none of the advice seems to apply. mod_rewrite is turned on,
  httpd.conf should be configured properly. Any other thoughts?

  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: dynamic variable names?

2008-06-07 Thread Dave

merci

but how do I declare these as global variables?
I tried:

global ${$y.'_'.$i};

but I got a Parse error:  syntax error, unexpected ','

On 7 Jun., 23:09, HappyNoff [EMAIL PROTECTED] wrote:
 On Jun 7, 9:54 pm, Dave [EMAIL PROTECTED] wrote:



  Hi guys,

  first post :)

  my question: is it possible to have dynamic variable names, I mean
  something like this:

  for($i=0;$ix;$i++){
  $y_$i = blabla;

  }

  in other words I want the number of the loop to be displayer in the
  name of the variable.

  Thanks for help.

 Hi,

 You can test this syntax :

 $y = 'test';

 for($i=0; $i  3; $i++)
 {
   ${$y.'_'.$i} = 'blabla';

 }

 echo $test_0;

 it should echo : blabla

 voila :)

--~--~-~--~~~---~--~~
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: dynamic variable names?

2008-06-07 Thread Simon COURTOIS

Dave wrote On 06/08/2008 01:47 AM:
 On 7 Jun., 23:09, HappyNoff [EMAIL PROTECTED] wrote:
   
 On Jun 7, 9:54 pm, Dave [EMAIL PROTECTED] wrote:
 
 Hi guys,

 first post :)
 my question: is it possible to have dynamic variable names, I mean
 something like this:

 for($i=0;$ix;$i++){
 $y_$i = blabla;
 }

 in other words I want the number of the loop to be displayer in the
 name of the variable.

 Thanks for help.
   
 Hi,

 You can test this syntax :

 $y = 'test';

 for($i=0; $i  3; $i++)
 {
   ${$y.'_'.$i} = 'blabla';

 }

 echo $test_0;

 it should echo : blabla

 voila :)
 

 merci

 but how do I declare these as global variables?
 I tried:

 global ${$y.'_'.$i};

 but I got a Parse error:  syntax error, unexpected ',
It depends on context... where do u want to declare this variables ? and 
where do you want to use it ?

Understand that when you type : ${$y.'_'.$i}
It's just a replacement.

If $y = 'test' and $i = '0', it's exactly like if you had 
${'test'.'_'.'0'}, or ${'test_0'} or $test_0...

Is your 'global' call in a function that needs previously declared 
variables ?

To help you, I need to understand what you wanna do and what you need ;)

-- 
Simon COURTOIS
{EPITECH.} tek4 | (LINAGORA) Developer | [ADITAM] Project Manager
10, rue Brillat-Savarin 75013 Paris | 01 45 42 72 30 - 06 72 44 67 81
http://www.happynoff.fr


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



new not equals syntax

2008-06-07 Thread .
i moved from cake 1.2.6 beta to 1.2.7 rc1.

I am trying to do a query Not Equals, but  does not work anymore. What is
it replaced by?

--~--~-~--~~~---~--~~
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: new not equals syntax

2008-06-07 Thread John David Anderson


On Jun 7, 2008, at 6:22 PM, . wrote:

 i moved from cake 1.2.6 beta to 1.2.7 rc1.

 I am trying to do a query Not Equals, but  does not work anymore.  
 What is it replaced by?

It was mentioned in the release announcment:

rather than:

'field' = 'operator value'

it is:

'field operator' = 'value'

My guess is you're still trying the latter (count =  4) when you  
should use the new syntax (count  = 4);

-- John

--~--~-~--~~~---~--~~
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: new not equals syntax

2008-06-07 Thread .
Ok that's right. thanks

On Sat, Jun 7, 2008 at 5:26 PM, John David Anderson 
[EMAIL PROTECTED] wrote:



 On Jun 7, 2008, at 6:22 PM, . wrote:

  i moved from cake 1.2.6 beta to 1.2.7 rc1.
 
  I am trying to do a query Not Equals, but  does not work anymore.
  What is it replaced by?

 It was mentioned in the release announcment:

 rather than:

 'field' = 'operator value'

 it is:

 'field operator' = 'value'

 My guess is you're still trying the latter (count =  4) when you
 should use the new syntax (count  = 4);

 -- John

 


--~--~-~--~~~---~--~~
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: dynamic variable names?

2008-06-07 Thread Dave

ok I got this array from the facebook API:

[affiliations]=
array(2) {
  [0]=
  array(5) {
[nid]=
string(8) 16779497
[name]=
string(11) RWTH Aachen
[type]=
string(7) college
[status]=
string(9) Undergrad
[year]=
string(1) 0
  }
  [1]=
  array(5) {
[nid]=
string(8) 67109293
[name]=
string(10) Luxembourg
[type]=
string(6) region
[status]=
string(0) 
[year]=
string(1) 0
  }
}

now i wrote a function split_vars() that should write the value of
nid, name, type, status and year into one variable. since there are
more than one arrays (2 in this case) it would be good if i could have
the number of the array in the name of the variable so that
$affiliations_1_name should echo Luxembourg.

I wrote this:

function split_vars(){
//This is just a part of the function, $user_info is the big array
where all the user_info data is
global $user_info, $affiliations, ${'affiliations_'.$i.'_nid'}, $
{'affiliations_'.$i.'_name'}, ${'affiliations_'.$i.'_type'}, $
{'affiliations_'.$i.'_status'}, ${'affiliations_'.$i.'_year'};

for($i=0;$icount($user_info[0]['affiliations']);$i++){
$affiliations = $user_info[0]['affiliations'][$i];
${'affiliations_'.$i.'_nid'} = $affiliations['nid'];
${'affiliations_'.$i.'_name'} = $affiliations['name'];
${'affiliations_'.$i.'_type'} = $affiliations['type'];
${'affiliations_'.$i.'_status'} = 
$affiliations['status'];
${'affiliations_'.$i.'_year'} = $affiliations['year'];
}
}

and outside of the variable I need to echo all these variable
variables.

But I get a Parse error:  syntax error, unexpected ',' in line where
globals are declared.

On 8 Jun., 02:10, Simon COURTOIS [EMAIL PROTECTED] wrote:
 Dave wrote On 06/08/2008 01:47 AM:

  On 7 Jun., 23:09, HappyNoff [EMAIL PROTECTED] wrote:

  On Jun 7, 9:54 pm, Dave [EMAIL PROTECTED] wrote:

  Hi guys,

  first post :)
  my question: is it possible to have dynamic variable names, I mean
  something like this:

  for($i=0;$ix;$i++){
  $y_$i = blabla;
  }

  in other words I want the number of the loop to be displayer in the
  name of the variable.

  Thanks for help.

  Hi,

  You can test this syntax :

  $y = 'test';

  for($i=0; $i  3; $i++)
  {
${$y.'_'.$i} = 'blabla';

  }

  echo $test_0;

  it should echo : blabla

  voila :)

  merci

  but how do I declare these as global variables?
  I tried:

  global ${$y.'_'.$i};

  but I got a Parse error:  syntax error, unexpected ',

 It depends on context... where do u want to declare this variables ? and
 where do you want to use it ?

 Understand that when you type : ${$y.'_'.$i}
 It's just a replacement.

 If $y = 'test' and $i = '0', it's exactly like if you had
 ${'test'.'_'.'0'}, or ${'test_0'} or $test_0...

 Is your 'global' call in a function that needs previously declared
 variables ?

 To help you, I need to understand what you wanna do and what you need ;)

 --
 Simon COURTOIS
 {EPITECH.} tek4 | (LINAGORA) Developer | [ADITAM] Project Manager
 10, rue Brillat-Savarin 75013 Paris | 01 45 42 72 30 - 06 72 44 67 
 81http://www.happynoff.fr

--~--~-~--~~~---~--~~
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: dynamic variable names?

2008-06-07 Thread b logica

Maybe you should just stick with an array and dynamic keys.

On Sat, Jun 7, 2008 at 7:47 PM, Dave [EMAIL PROTECTED] wrote:

 merci

 but how do I declare these as global variables?
 I tried:

 global ${$y.'_'.$i};

 but I got a Parse error:  syntax error, unexpected ','

 On 7 Jun., 23:09, HappyNoff [EMAIL PROTECTED] wrote:
 On Jun 7, 9:54 pm, Dave [EMAIL PROTECTED] wrote:



  Hi guys,

  first post :)

  my question: is it possible to have dynamic variable names, I mean
  something like this:

  for($i=0;$ix;$i++){
  $y_$i = blabla;

  }

  in other words I want the number of the loop to be displayer in the
  name of the variable.

  Thanks for help.

 Hi,

 You can test this syntax :

 $y = 'test';

 for($i=0; $i  3; $i++)
 {
   ${$y.'_'.$i} = 'blabla';

 }

 echo $test_0;

 it should echo : blabla

 voila :)

 


--~--~-~--~~~---~--~~
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: Strict or Pretty? We're looking for a few good opinions

2008-06-07 Thread b logica

On Sat, Jun 7, 2008 at 6:26 PM, keymaster [EMAIL PROTECTED] wrote:

 Better to work with the system.

convention over configuration

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



paginator options newbie question

2008-06-07 Thread .
I am using cake rc1

In the following link, i am trying to find the list of keys for the
'options' variable, but can't find it. does any one have the link to all of
the available keys?

http://api.cakephp.org/1.2/class_paginator_helper.html#9c836737a166d2cdb2c0f666add5d845

2) I am trying to set up the paginator so that when it reaches the last
page, the Next button will return to the first page.

Something like this:
echo $paginator-next('Next', array(), 'Next', array('page'=1));

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



controller paginate method

2008-06-07 Thread .
in cake RC1 1.2, what are the options available for the controller method
$this-paginate(model, options, ? ? ? )

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: What is the best Image Upload / Thumbnail package for CakePHP?

2008-06-07 Thread stefanski

here is my file  image upload behaviour based on the code of iamkoa
labs:
http://bin.cakephp.org/saved/33249

On 7 Jun., 04:04, Dardo Sordi Bogado [EMAIL PROTECTED] wrote:
  AD7six upload behavior is the best tool thast you will find for this.

 Totally agree with Martin! Thanks AD7six for sharing this gem.

 Regards,
 Dardo Sordi.

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