Re: coding a loop in cake?

2010-08-13 Thread Jeremy Burns | Class Outfit
What's so wrong with using the (auto incrementing unique) id field then?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Aug 2010, at 08:39, Tomfox Wiranata wrote:

 hey sam, thx. the number is sth like a product code. each product will
 be assigned with a unique number...
 
 seems like an alternative, since i am too stupid to make it with do
 while^^
 
 
 
 On 13 Aug., 05:22, Sam s...@masterscommission360.com wrote:
 Also- I just had an idea... it is kind of janky but I think it will do
 what you want with a good speed increase.
 
 When you get your random number, check if it is already in the
 database by doing the following:
 $count = $this-find(
 'count',
 array(
 'conditions' = array(
 'Linkable.number' = $randomNumber
 )
 )
 );
 
 If $count is not 0 then the number already exists in the database- now
 instead of getting all the db values and looping a bunch of times,
 generate 10 random numbers and put them in an array and do the
 following
 
 $linkNumbers = $this-find(
 'list',
 array(
 'conditions' = array(
 'Linkable.number' =
 $randomNumberArray
 )
 )
 );
 
 Count the elements in the returned array(count($linkNumbers))- if it
 is less then 10 then at least one of the random numbers you generated
 is not yet in the database- use array_diff to find out which values
 are not in the database and you will be left with an array of good
 random numbers to use:
 $unusedRandomNumbers = array_diff($linkNumbers, $randomNumberArray)
 
 If the $linkNumbers array has 10 elements then just repeat the
 process.
 
 On Aug 12, 7:41 pm, Sam s...@masterscommission360.com wrote:
 
 Can you tell us what you are using this random number for? This might
 be a situation where there is an alternative solution that we could
 help you out with if we knew why you needed the random numbers. Also-
 on the topic of uuid's, aren't they just a hexadecimal number?
 Couldn't you just convert them to decimal as needed?
 
 On Aug 12, 3:10 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 
 thx to both of you. i know i always do things complicated...
 
 so if i do what you suggested, cricket:
 
 public function getNewNumber()
 {
 do
 {
 $new_number = rand(10,10);
 }
 while ($this-_testNewNumber($new_number));
 
 return $new_number;
 
 }
 
 i'm having an endless loop :(
 
 how would my function look like, that is checking for existence? cant
 believe i am having so much trouble with this
 
 On 12 Aug., 03:35, cricket zijn.digi...@gmail.com wrote:
 
 On Wed, Aug 11, 2010 at 4:45 PM, McBuck DGAF mcbuckd...@gmail.com wrote:
 This whole process strikes me as very inefficient.  There is no
 mechanism to prevent your do-while loop from checking the same value
 an infinite number of times (unless you log each random value and
 check the next random value against the log AND the db).
 
 I don't know what the purpose of the random value is in your app, but
 I would suggest an entirely different approach.  If you need random
 values in the range of min through max, you could generate a table
 ahead of time consisting of the fields id and random_number, with max-
 min+1 rows.  (There are many random number generator sites available,
 and you might be able to access one of their APIs as needed.)
 
 It seems to me that it would be easier to generate these unique values
 in some random order ahead of time, and then just associate the
 random_numbers table with your current table through a 1-1
 relationship.  This process would make it easy to identify the next
 random number to be assigned, and when the random numbers have been
 exhausted.
 
 Just a thought.
 
 What McBuck said. I've given you a solution but you're implementing it
 in a very strange way. FWIW, this:
 
 while ($eyed = $this-Linkable-validateEyed($lkbl_eyed) ==
 taken);
 
 is always going to return true. Why are you assigning a value to
 $eyed, which is never used, in any case? That assignment is what is
 screwing things up.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send

Re: Calling Validation-cc() from the controller

2010-08-13 Thread Jeremy Burns | Class Outfit
Yes, I already do this. Create /app/models/credit_card.php;

?php
class CreditCard extends AppModel {

var $name = 'CreditCard';

var $useTable = false;

var $validate = array(
'card_number' = array(
'notempty' = array(
'rule' = 'notEmpty',
'message' = 'Please enter a credit card 
number.',
'required' = true,
'last' = true
),
'maxLength' = array(
'rule' = array('maxLength', 20),
'message' = 'The credit card number must 20 
characters or less.',
'last' = true
),
'valid' = array(
'rule' = array('cc', 'fast', false, null),
'message' = 'The credit card number you 
supplied was invalid.'
)
),
'card_type' = array(
'rule' = 'notEmpty',
'message' = 'Please select a credit card type.',
'required' = true
),
'exp_month' = array(
'rule' = 'notEmpty',
'message' = 'Please select a credit card expiry 
month.',
'required' = true
),
'exp_year' = array(
'rule' = 'notEmpty',
'message' = 'Please select a credit card expiry year.',
'required' = true
),
'cardid_number' = array(
'rule' = 'notEmpty',
'message' = 'Please enter a security code.',
'required' = true
)
);
}
?

Then at the right time in the order process:

if (isset($this-data['CreditCard'])):

$creditCard = ClassRegistry::init('CreditCard');

$creditCard-set( $this-data );

if ($creditCard-validates($this-data['CreditCard'])):

$this-Session-write('creditCard',
array(
'card_type' = 
$this-data['CreditCard']['card_type'],
'card_number' = 
$this-data['CreditCard']['card_number'],
'exp_month' = 
$this-data['CreditCard']['exp_month'],
'exp_year' = 
$this-data['CreditCard']['exp_year'],
'cardid_number' = 
$this-data['CreditCard']['cardid_number']
)
);

else:

$validationErrors['CreditCard'] = $creditCard-validationErrors;

endif;

endif;


Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Aug 2010, at 08:55, Wilhelm wrote:

 Hi,
 
 I am implementing a e-commerce website, in my project for security
 reasons I am not storing the users credit card details in the database
 but rather that is being handled by a third party.
 
 My question is that I would like to use the cc validation to validate
 the credit card number before sending it off to the third party. Is
 this possible?
 
 Kind Regards
 Wilhelm
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Calling Validation-cc() from the controller

2010-08-13 Thread Jeremy Burns | Class Outfit
I let the card processing company do that - is there a way to do it locally 
before submitting? I'd be interested if there is a method for that.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Aug 2010, at 09:20, Louie Miranda wrote:

 How about validating proper security code?
 --
 Louie Miranda
  - Email: lmira...@gmail.com
  - Web: http://www.louiemiranda.com
 
 
 
 On Fri, Aug 13, 2010 at 4:08 PM, Jeremy Burns | Class Outfit 
 jeremybu...@classoutfit.com wrote:
 Yes, I already do this. Create /app/models/credit_card.php;
 
 ?php
 class CreditCard extends AppModel {
 
var $name = 'CreditCard';
 
var $useTable = false;
 
var $validate = array(
'card_number' = array(
'notempty' = array(
'rule' = 'notEmpty',
'message' = 'Please enter a credit card 
 number.',
'required' = true,
'last' = true
),
'maxLength' = array(
'rule' = array('maxLength', 20),
'message' = 'The credit card number must 20 
 characters or less.',
'last' = true
),
'valid' = array(
'rule' = array('cc', 'fast', false, null),
'message' = 'The credit card number you 
 supplied was invalid.'
)
),
'card_type' = array(
'rule' = 'notEmpty',
'message' = 'Please select a credit card type.',
'required' = true
),
'exp_month' = array(
'rule' = 'notEmpty',
'message' = 'Please select a credit card expiry 
 month.',
'required' = true
),
'exp_year' = array(
'rule' = 'notEmpty',
'message' = 'Please select a credit card expiry 
 year.',
'required' = true
),
'cardid_number' = array(
'rule' = 'notEmpty',
'message' = 'Please enter a security code.',
'required' = true
)
);
 }
 ?
 
 Then at the right time in the order process:
 
 if (isset($this-data['CreditCard'])):
 
$creditCard = ClassRegistry::init('CreditCard');
 
$creditCard-set( $this-data );
 
if ($creditCard-validates($this-data['CreditCard'])):
 
$this-Session-write('creditCard',
array(
'card_type' = 
 $this-data['CreditCard']['card_type'],
'card_number' = 
 $this-data['CreditCard']['card_number'],
'exp_month' = 
 $this-data['CreditCard']['exp_month'],
'exp_year' = 
 $this-data['CreditCard']['exp_year'],
'cardid_number' = 
 $this-data['CreditCard']['cardid_number']
)
);
 
else:
 
$validationErrors['CreditCard'] = 
 $creditCard-validationErrors;
 
endif;
 
 endif;
 
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 13 Aug 2010, at 08:55, Wilhelm wrote:
 
  Hi,
 
  I am implementing a e-commerce website, in my project for security
  reasons I am not storing the users credit card details in the database
  but rather that is being handled by a third party.
 
  My question is that I would like to use the cc validation to validate
  the credit card number before sending it off to the third party. Is
  this possible?
 
  Kind Regards
  Wilhelm
 
  Check out the new CakePHP Questions site http://cakeqs.org and help others 
  with their CakePHP related questions.
 
  You received this message because you are subscribed to the Google Groups 
  CakePHP group.
  To post to this group, send email to cake-php@googlegroups.com
  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
  http://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related

Re: coding a loop in cake?

2010-08-13 Thread Jeremy Burns | Class Outfit
The number will rise by 1 on each insert (or attempted insert that fails 
validation at the database level) and once a number has been used it is no 
longer available (although it is possible to do a direct insert using SQL, but 
not really recommended). It isn't really possible to reserve numbers ahead of 
time without doing lots of fancy stuff.

Reading this whole trail it seems that you are using a sledgehammer to crack a 
nut. I'd keep it simple and let the database do what it was born to do.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Aug 2010, at 09:42, Tomfox Wiranata wrote:

 i was under the impression, that it makes trouble, when a product will
 be deleted and the number is free again. will this number then be
 skipped cause auto increment passed it a long time ago?
 
 also i want specific numbers to be reserved. so these ones should be
 left out when auto incrementing...
 
 if those 2 thing wont bother then it would be fine, i guess.
 
 On 13 Aug., 09:46, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 What's so wrong with using the (auto incrementing unique) id field then?
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 13 Aug 2010, at 08:39, Tomfox Wiranata wrote:
 
 hey sam, thx. the number is sth like a product code. each product will
 be assigned with a unique number...
 
 seems like an alternative, since i am too stupid to make it with do
 while^^
 
 On 13 Aug., 05:22, Sam s...@masterscommission360.com wrote:
 Also- I just had an idea... it is kind of janky but I think it will do
 what you want with a good speed increase.
 
 When you get your random number, check if it is already in the
 database by doing the following:
 $count = $this-find(
 'count',
 array(
 'conditions' = array(
 'Linkable.number' = $randomNumber
 )
 )
 );
 
 If $count is not 0 then the number already exists in the database- now
 instead of getting all the db values and looping a bunch of times,
 generate 10 random numbers and put them in an array and do the
 following
 
 $linkNumbers = $this-find(
 'list',
 array(
 'conditions' = array(
 'Linkable.number' =
 $randomNumberArray
 )
 )
 );
 
 Count the elements in the returned array(count($linkNumbers))- if it
 is less then 10 then at least one of the random numbers you generated
 is not yet in the database- use array_diff to find out which values
 are not in the database and you will be left with an array of good
 random numbers to use:
 $unusedRandomNumbers = array_diff($linkNumbers, $randomNumberArray)
 
 If the $linkNumbers array has 10 elements then just repeat the
 process.
 
 On Aug 12, 7:41 pm, Sam s...@masterscommission360.com wrote:
 
 Can you tell us what you are using this random number for? This might
 be a situation where there is an alternative solution that we could
 help you out with if we knew why you needed the random numbers. Also-
 on the topic of uuid's, aren't they just a hexadecimal number?
 Couldn't you just convert them to decimal as needed?
 
 On Aug 12, 3:10 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 
 thx to both of you. i know i always do things complicated...
 
 so if i do what you suggested, cricket:
 
 public function getNewNumber()
 {
 do
 {
 $new_number = rand(10,10);
 }
 while ($this-_testNewNumber($new_number));
 
 return $new_number;
 
 }
 
 i'm having an endless loop :(
 
 how would my function look like, that is checking for existence? cant
 believe i am having so much trouble with this
 
 On 12 Aug., 03:35, cricket zijn.digi...@gmail.com wrote:
 
 On Wed, Aug 11, 2010 at 4:45 PM, McBuck DGAF mcbuckd...@gmail.com 
 wrote:
 This whole process strikes me as very inefficient.  There is no
 mechanism to prevent your do-while loop from checking the same value
 an infinite number of times (unless you log each random value and
 check the next random value against the log AND the db).
 
 I don't know what the purpose of the random value is in your app, but
 I would suggest an entirely different approach.  If you need random
 values in the range of min through max, you could generate a table
 ahead of time consisting of the fields id and random_number, with max-
 min+1 rows.  (There are many random number generator sites available,
 and you might be able to access one of their APIs as needed.)
 
 It seems to me that it would be easier to generate these unique values
 in some random order ahead of time, and then just associate the
 random_numbers table with your current table through a 1-1
 relationship.  This process would make it easy to identify the next
 random number

Re: coding a loop in cake?

2010-08-13 Thread Jeremy Burns | Class Outfit
I don't know the rest of your set up, but auto increment would seem like a 
really simple solution. It wouldn't need any programming either, which must be 
a good thing.

You mention re-using numbers - I would guess that re-using a number that 
previously identified a completely different (and potentially obsolete) product 
is a bad thing.

On balance, I would say that letting the database assign a new, unique and 
automatically generated number each time you create a product sounds like the 
right thing to do - unless there is some rock solid reason why this would break 
something else.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Aug 2010, at 10:04, Tomfox Wiranata wrote:

 so you would suggest auto_increment?
 
 On 13 Aug., 10:48, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 The number will rise by 1 on each insert (or attempted insert that fails 
 validation at the database level) and once a number has been used it is no 
 longer available (although it is possible to do a direct insert using SQL, 
 but not really recommended). It isn't really possible to reserve numbers 
 ahead of time without doing lots of fancy stuff.
 
 Reading this whole trail it seems that you are using a sledgehammer to crack 
 a nut. I'd keep it simple and let the database do what it was born to do.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 13 Aug 2010, at 09:42, Tomfox Wiranata wrote:
 
 i was under the impression, that it makes trouble, when a product will
 be deleted and the number is free again. will this number then be
 skipped cause auto increment passed it a long time ago?
 
 also i want specific numbers to be reserved. so these ones should be
 left out when auto incrementing...
 
 if those 2 thing wont bother then it would be fine, i guess.
 
 On 13 Aug., 09:46, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 What's so wrong with using the (auto incrementing unique) id field then?
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 13 Aug 2010, at 08:39, Tomfox Wiranata wrote:
 
 hey sam, thx. the number is sth like a product code. each product will
 be assigned with a unique number...
 
 seems like an alternative, since i am too stupid to make it with do
 while^^
 
 On 13 Aug., 05:22, Sam s...@masterscommission360.com wrote:
 Also- I just had an idea... it is kind of janky but I think it will do
 what you want with a good speed increase.
 
 When you get your random number, check if it is already in the
 database by doing the following:
 $count = $this-find(
 'count',
 array(
 'conditions' = array(
 'Linkable.number' = $randomNumber
 )
 )
 );
 
 If $count is not 0 then the number already exists in the database- now
 instead of getting all the db values and looping a bunch of times,
 generate 10 random numbers and put them in an array and do the
 following
 
 $linkNumbers = $this-find(
 'list',
 array(
 'conditions' = array(
 'Linkable.number' =
 $randomNumberArray
 )
 )
 );
 
 Count the elements in the returned array(count($linkNumbers))- if it
 is less then 10 then at least one of the random numbers you generated
 is not yet in the database- use array_diff to find out which values
 are not in the database and you will be left with an array of good
 random numbers to use:
 $unusedRandomNumbers = array_diff($linkNumbers, $randomNumberArray)
 
 If the $linkNumbers array has 10 elements then just repeat the
 process.
 
 On Aug 12, 7:41 pm, Sam s...@masterscommission360.com wrote:
 
 Can you tell us what you are using this random number for? This might
 be a situation where there is an alternative solution that we could
 help you out with if we knew why you needed the random numbers. Also-
 on the topic of uuid's, aren't they just a hexadecimal number?
 Couldn't you just convert them to decimal as needed?
 
 On Aug 12, 3:10 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 
 thx to both of you. i know i always do things complicated...
 
 so if i do what you suggested, cricket:
 
 public function getNewNumber()
 {
 do
 {
 $new_number = rand(10,10);
 }
 while ($this-_testNewNumber($new_number));
 
 return $new_number;
 
 }
 
 i'm having an endless loop :(
 
 how would my function look like, that is checking for existence? cant
 believe i am having so much trouble with this
 
 On 12 Aug., 03:35, cricket zijn.digi...@gmail.com wrote:
 
 On Wed, Aug 11, 2010 at 4:45 PM, McBuck DGAF mcbuckd...@gmail.com 
 wrote:
 This whole process strikes me as very inefficient.  There is no
 mechanism to prevent your do

Re: coding a loop in cake?

2010-08-13 Thread Jeremy Burns | Class Outfit
Use the right data type. If you are concerned about the numbers running out use 
an unsigned bigint; that goes to 1,8446,744,073,709,551,615. Would that be 
enough for you? ;-)

http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Aug 2010, at 10:24, Tomfox Wiranata wrote:

 only onewhat if all numbers are used? it might take a while but
 the time will come
 
 On 13 Aug., 11:09, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 I don't know the rest of your set up, but auto increment would seem like a 
 really simple solution. It wouldn't need any programming either, which must 
 be a good thing.
 
 You mention re-using numbers - I would guess that re-using a number that 
 previously identified a completely different (and potentially obsolete) 
 product is a bad thing.
 
 On balance, I would say that letting the database assign a new, unique and 
 automatically generated number each time you create a product sounds like 
 the right thing to do - unless there is some rock solid reason why this 
 would break something else.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 13 Aug 2010, at 10:04, Tomfox Wiranata wrote:
 
 so you would suggest auto_increment?
 
 On 13 Aug., 10:48, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 The number will rise by 1 on each insert (or attempted insert that fails 
 validation at the database level) and once a number has been used it is no 
 longer available (although it is possible to do a direct insert using SQL, 
 but not really recommended). It isn't really possible to reserve numbers 
 ahead of time without doing lots of fancy stuff.
 
 Reading this whole trail it seems that you are using a sledgehammer to 
 crack a nut. I'd keep it simple and let the database do what it was born 
 to do.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 13 Aug 2010, at 09:42, Tomfox Wiranata wrote:
 
 i was under the impression, that it makes trouble, when a product will
 be deleted and the number is free again. will this number then be
 skipped cause auto increment passed it a long time ago?
 
 also i want specific numbers to be reserved. so these ones should be
 left out when auto incrementing...
 
 if those 2 thing wont bother then it would be fine, i guess.
 
 On 13 Aug., 09:46, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 What's so wrong with using the (auto incrementing unique) id field then?
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 13 Aug 2010, at 08:39, Tomfox Wiranata wrote:
 
 hey sam, thx. the number is sth like a product code. each product will
 be assigned with a unique number...
 
 seems like an alternative, since i am too stupid to make it with do
 while^^
 
 On 13 Aug., 05:22, Sam s...@masterscommission360.com wrote:
 Also- I just had an idea... it is kind of janky but I think it will do
 what you want with a good speed increase.
 
 When you get your random number, check if it is already in the
 database by doing the following:
 $count = $this-find(
 'count',
 array(
 'conditions' = array(
 'Linkable.number' = $randomNumber
 )
 )
 );
 
 If $count is not 0 then the number already exists in the database- now
 instead of getting all the db values and looping a bunch of times,
 generate 10 random numbers and put them in an array and do the
 following
 
 $linkNumbers = $this-find(
 'list',
 array(
 'conditions' = array(
 'Linkable.number' =
 $randomNumberArray
 )
 )
 );
 
 Count the elements in the returned array(count($linkNumbers))- if it
 is less then 10 then at least one of the random numbers you generated
 is not yet in the database- use array_diff to find out which values
 are not in the database and you will be left with an array of good
 random numbers to use:
 $unusedRandomNumbers = array_diff($linkNumbers, $randomNumberArray)
 
 If the $linkNumbers array has 10 elements then just repeat the
 process.
 
 On Aug 12, 7:41 pm, Sam s...@masterscommission360.com wrote:
 
 Can you tell us what you are using this random number for? This might
 be a situation where there is an alternative solution that we could
 help you out with if we knew why you needed the random numbers. Also-
 on the topic of uuid's, aren't they just a hexadecimal number?
 Couldn't you just convert them to decimal as needed?
 
 On Aug 12, 3:10 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 
 thx to both of you. i know i always do things complicated...
 
 so if i do what you suggested, cricket:
 
 public function getNewNumber

Re: Not serving css or js

2010-08-12 Thread Jeremy Burns | Class Outfit
Check that your .htaccess files are present and correct.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 12 Aug 2010, at 11:34, Paul wrote:

 Hi, I've recently started with Cake
 
 and I'm having trouble serving script files despite following the
 docs: http://book.cakephp.org/view/1437/css
 
 I get the html fine but I'm not being served the js and css files out
 of the respective webroot sub-directories.
 
 I'm using php 5.2 + Lighttpd on Windows XP
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: coding a loop in cake?

2010-08-11 Thread Jeremy Burns | Class Outfit
Do you have a unique index on the field? If you haven't and you really do want 
it to be unique, I'd stick on on. Then you could work on the basis that you 
*probably* aren't going to run into the same number that often (at least it is 
far more likely that your number is unique than it is a duplicate), generate a 
random number, save it and only create another one of the save fails (then 
rinse and repeat).

Would a UUID work for you? That would save you some effort.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 11 Aug 2010, at 10:18, Tomfox Wiranata wrote:

 ok i tried your solution and somehow cake does not care if it writes
 the same number over and over in my database. maybe you see what's
 wrong here :)
 
 my function in my model abc that finds and compares the number. my
 logic: when no entry is found here $eyed is empty.
 
function validateEyed($data)
{
$eyed = $this-find(array('eyed' = $data), array('eyed'));
if(empty($eyed) == true)
return $eyed['abc'];
return false;
}
 
 
 I am calling this function from my controller
 
function __createEyed()
{
 
   do{
   $test=rand(1,2);
   }
   while ($eyed = $this-abc-validateEyed($test) == true);
   return $test;
}
 
 
 cakes writes those rand numbers 1 or 2 multiple times in my table.
 so where is the mistake??
 
 thx :)
 
 
 On 10 Aug., 18:39, cricket zijn.digi...@gmail.com wrote:
 On Tue, Aug 10, 2010 at 12:30 PM, Tomfox Wiranata
 
 tomfox.wiran...@gmail.com wrote:
 thx to both..
  :)
 
 @cricket:
 
 am i getting it right? you are writing all numers from the database
 into an array and compare both? is it possible that at a certain point
 it will get to big or too much data? cause my range starts at
 1 and ends at 9
 
 if there are 50million in the table they all get saved in an array
 
 Yes, that's correct. I should have pointed that out. You could cache
 the results, of course, but perhaps a better way would be to pass
 $new_number to a protected method (that does a find() and comparison)
 inside the while section. You'd have to have the separate method
 because while() isn't a block, where you can have several lines of
 code. Something like:
 
 public function getNewNumber()
 {
 do
 {
 $new_number = rand(10,10);
 }
 while ($this-_testNewNumber($new_number));
 
 return $new_number;
 
 }
 
 protected function _testNewNumber($x)
 {
 // return $x exists in DB
 
 }
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: coding a loop in cake?

2010-08-11 Thread Jeremy Burns | Class Outfit
Check the Cake section on UUIDs first to see if it is a possible solution for 
you - it might not be, of course. They are usually used when the field is an 
auto incrementing primary key - I am not sure if they are flexible enough to 
work as non primary keys.

http://book.cakephp.org/view/1016/Using-UUIDs-as-Primary-Keys

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 11 Aug 2010, at 11:05, Tomfox Wiranata wrote:

 thx for your reply jeremy.
 
 i dont have an unique index for that field. at least i didnt remember
 doing that..
 
 how do i create this UUID in xampp and what do I have to change in my
 code?
 
 thx :)
 
 On 11 Aug., 11:50, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 Do you have a unique index on the field? If you haven't and you really do 
 want it to be unique, I'd stick on on. Then you could work on the basis that 
 you *probably* aren't going to run into the same number that often (at least 
 it is far more likely that your number is unique than it is a duplicate), 
 generate a random number, save it and only create another one of the save 
 fails (then rinse and repeat).
 
 Would a UUID work for you? That would save you some effort.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 11 Aug 2010, at 10:18, Tomfox Wiranata wrote:
 
 ok i tried your solution and somehow cake does not care if it writes
 the same number over and over in my database. maybe you see what's
 wrong here :)
 
 my function in my model abc that finds and compares the number. my
 logic: when no entry is found here $eyed is empty.
 
function validateEyed($data)
{
$eyed = $this-find(array('eyed' = $data), array('eyed'));
if(empty($eyed) == true)
return $eyed['abc'];
return false;
}
 
 I am calling this function from my controller
 
function __createEyed()
{
 
do{
$test=rand(1,2);
}
while ($eyed = $this-abc-validateEyed($test) == true);
return $test;
}
 
 cakes writes those rand numbers 1 or 2 multiple times in my table.
 so where is the mistake??
 
 thx :)
 
 On 10 Aug., 18:39, cricket zijn.digi...@gmail.com wrote:
 On Tue, Aug 10, 2010 at 12:30 PM, Tomfox Wiranata
 
 tomfox.wiran...@gmail.com wrote:
 thx to both..
  :)
 
 @cricket:
 
 am i getting it right? you are writing all numers from the database
 into an array and compare both? is it possible that at a certain point
 it will get to big or too much data? cause my range starts at
 1 and ends at 9
 
 if there are 50million in the table they all get saved in an array
 
 Yes, that's correct. I should have pointed that out. You could cache
 the results, of course, but perhaps a better way would be to pass
 $new_number to a protected method (that does a find() and comparison)
 inside the while section. You'd have to have the separate method
 because while() isn't a block, where you can have several lines of
 code. Something like:
 
 public function getNewNumber()
 {
 do
 {
 $new_number = rand(10,10);
 }
 while ($this-_testNewNumber($new_number));
 
 return $new_number;
 
 }
 
 protected function _testNewNumber($x)
 {
 // return $x exists in DB
 
 }
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem in save Data into DB and with Created and modified fields.

2010-08-10 Thread Jeremy Burns | Class Outfit
$this-ModelName-create() [[NB NOT created ]] does exactly what it says it 
will; it creates a new record. In any event, your two blocks of code are 
different; one has a create statement, the other does not. What you should 
check is whether there is an id element in your data array. If there is one, 
Cake will update that row. If there isn't one, Cake will create a new row.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Aug 2010, at 06:48, Techinfocomp.com wrote:

 Hi,
 
 i am using 1.3.3 stable version.
 
 i am heaving problem with this version.
 
 let take an example:-
 
 if i do this
 
 $this-ModelName-save($this-data);
 
 this link will update my 1st row every time i run this.
 
 but
 
 if i do this
 
 $this-ModelName-created();
 $this-ModelName-save($this-data);
 
 this will create new record in table.
 
 why is this happen all the time, i never face this king of problem in
 version 1.2.
 
 
 now another problem.
 
 on my local pc i am running vista with xampp and cakePHP version 1.3.3
 
 created filed in table is working fine. model automatically create
 data for this column but it's not working on live server which is
 running php 5 , my sql 5.
 
 
 any help ?
 
 waiting for your reply
 
 Thanks
 Harsh Gupta
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: relationship advice

2010-08-10 Thread Jeremy Burns | Class Outfit
That sounds like one table too many to me. You can get what you want by doing 
simple finds, made even easier by using the containable behaviour, IMO.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Aug 2010, at 11:26, Felix wrote:

 Thanks, Jeremy, Andras - I think I've worked it out now,
 
 I wanted to keep the HABTM relationship so I could easily list all the
 products in an order and find all the orders a particular product is
 listed in, the HABTM seems the easiest way to do it so I'll leave that
 as it is. I've added an additional table to store the quantity and
 other info.
 
 Thanks for your quick replies,
 
 Felix
 
 On Aug 9, 6:59 pm, Andras Kende and...@kende.com wrote:
 Felix,
 
 for a simple cart not sure if habtm is needed...
 
 could be:
 
 products
 id | name | description | image | price | qty
 
 orders
 id | name | address | grandtotal | tracking | status |
 
 order hasmany orderi_tems
 
 order_items
 id | order_id | product_id | qty | price |etc...
 
 order_items belongsto order , product
 
 Andras Kendehttp://www.kende.com
 
 On Aug 9, 2010, at 12:27 PM, Felix wrote:
 
 
 
 Hi, I was wondering if anyone can help with a problem I'm having.
 
 I'm building a simple shopping cart system for which I have two
 objects
 
 1. Product (stores product details - name, cost, SKU, etc.)
 
 2. Order (Stores order details - customer address, shipping type,
 etc.)
 
 In the database these are joined using the table, orders_products.
 
 Cake correctly recognises the HABTM relationship between the two, so
 far so good.
 
 What I'm now stuck at is how to incorporate a quantity variable.
 
 Each product in an order must have a quantity but I don't know where
 to put it,
 
 I don't think it belongs in the products table or the order table, so
 the only place I can think of is in the join table (orders_products).
 
 If I add this field in how would I then set or read its value, seeing
 as it has no model I don;t know how to address it.
 
 The join table does show up when baking so I could add one, but I
 don't know if this would mess up the HABTM between the product and
 order models, and if it does what relationships I need to define in
 the relevant models to resolve such issues.
 
 I may of course be missing something or asking a very stupid question,
 in which case sorry but could you point out my idiocy!
 
 Thanks, Felix
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: how do i preset a value for an input field?

2010-08-10 Thread Jeremy Burns | Class Outfit
Use the 'default' option:

echo $this-Form-input('fieldName', array('default' = 'your default'));

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Aug 2010, at 14:47, james wrote:

 I'm passing some variables from a view to an add and I would like
 those variables to be preset in some of the input fields.
 
 So for in lead-view.ctp i get the variable $leads['Lead']
 ['business_name'];
 
 and pass it to appointment-add.ctp.
 
 in this second view the field business name (still an input) would
 then have that data already in the field.
 
 Thanks!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: customize error message

2010-08-09 Thread Jeremy Burns | Class Outfit
Do you mean the style? If so, by default the message is placed into a div (for 
example, for an auth error, div id=flashMessage) which you can style using 
CSS. Or you can set a particular class when you set the flash message:

$this-Session-setFlash('Example message text', 'default', array('class' = 
'example_class'))

See http://book.cakephp.org/view/1313/setFlash

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 8 Aug 2010, at 05:38, hoss7 wrote:

 how can i customize error message(setflash or flash function)?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: how to make sum query on cake ?

2010-08-09 Thread Jeremy Burns | Class Outfit
There is an example here 
(http://book.cakephp.org/view/1030/Complex-Find-Conditions) that shows how to 
do a MIN query, which is essentially the same thing.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Aug 2010, at 10:09, Cruisine wrote:

 hi i'm still newbie at cakephp.
 and i still wondering how to make sum query on cakephp ?
 for example i want to make a query like this :
 select count(id) as customer, sum(payment) as money from customer
 where department_id=1
 how to implement it on cakephp ??
 do you have the solution ?
 i need ur help..tq
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: how to make sum query on cake ?

2010-08-09 Thread Jeremy Burns | Class Outfit
Follow the MIN example, and replace the MIN with SUM.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Aug 2010, at 10:34, Cruisine wrote:

 tq for ur answer.
 but i couldnt found any statement that explaining about how to sum a
 field in query on cakephp..
 so..any idea?
 
 On Aug 9, 4:23 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 There is an example here 
 (http://book.cakephp.org/view/1030/Complex-Find-Conditions) that shows how 
 to do a MIN query, which is essentially the same thing.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 9 Aug 2010, at 10:09, Cruisine wrote:
 
 hi i'm still newbie at cakephp.
 and i still wondering how to make sum query on cakephp ?
 for example i want to make a query like this :
 select count(id) as customer, sum(payment) as money from customer
 where department_id=1
 how to implement it on cakephp ??
 do you have the solution ?
 i need ur help..tq
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: auto input value to a field

2010-08-09 Thread Jeremy Burns | Class Outfit
Use the default property: http://book.cakephp.org/view/1402/options-default

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Aug 2010, at 16:00, james wrote:

 Hi,
 
 I have a user field that at the moment is populated via a dropdown
 that is a list of all users in the tabel. What I'd like to do is auto
 populate that field from theAuth.User.username value so that the user
 never has to enter their name in a record.
 
 How is this done?
 
 thanks!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: relationship advice

2010-08-09 Thread Jeremy Burns | Class Outfit
I'd be tempted to have an order_items table that is not ruled by habtm. Then 
you can add columns for product_id, quantity, price_charged, tax, dispatched 
etc.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Aug 2010, at 17:27, Felix wrote:

 Hi, I was wondering if anyone can help with a problem I'm having.
 
 I'm building a simple shopping cart system for which I have two
 objects
 
 1. Product (stores product details - name, cost, SKU, etc.)
 
 2. Order (Stores order details - customer address, shipping type,
 etc.)
 
 In the database these are joined using the table, orders_products.
 
 Cake correctly recognises the HABTM relationship between the two, so
 far so good.
 
 What I'm now stuck at is how to incorporate a quantity variable.
 
 Each product in an order must have a quantity but I don't know where
 to put it,
 
 I don't think it belongs in the products table or the order table, so
 the only place I can think of is in the join table (orders_products).
 
 If I add this field in how would I then set or read its value, seeing
 as it has no model I don;t know how to address it.
 
 The join table does show up when baking so I could add one, but I
 don't know if this would mess up the HABTM between the product and
 order models, and if it does what relationships I need to define in
 the relevant models to resolve such issues.
 
 I may of course be missing something or asking a very stupid question,
 in which case sorry but could you point out my idiocy!
 
 Thanks, Felix
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Element inside element

2010-08-07 Thread Jeremy Burns | Class Outfit
Have you tried? If so, what happens?

Sent from my iPad

On 8 Aug 2010, at 03:09, Hugo M ham1...@gmail.com wrote:

 It is possibly to render an element inside another element?
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: how can I check for a specific value in my session?

2010-08-06 Thread Jeremy Burns | Class Outfit
You can check if a session element exists by using the check method 
(http://book.cakephp.org/view/403/check).

So:

if ($this-Session-check('abc.imageuploaded')):
do something;
else:
do nothing;
endif;

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 6 Aug 2010, at 12:33, Tomfox Wiranata wrote:

 hey everyone,
 
 in my controller I need to make a check if an image was uploaded or
 not. the way to find this out is to check a specific session variable
 for its value. lets say the user does upload an image. then I code:
 
 session.write('abc.imageuploaded', true);
 
 in case no image is uploaded I write nothing in this session value.
 now I tried to make the check like this:
 
 if ($this-session-read('abc.imageuploaded') == true){
 
 do stuff
 
 }
 
 else{
 
 do other stuff
 
 }
 
 
 unfortunately cake kinda skips my check an executes the if-clause
 everytime. i also tried
 
 if (empty($this-session-read('abc.imageuploaded')) but cake doesnt
 like that at all
 
 looking forward to your help :)
 
 thx
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


saveAll does'nt work

2010-07-29 Thread Jeremy
today, I find function saveAll can not work ,when save data into two
relations tables, blew is the data,

Array
(
[User] = Array
(
[username] = tester
[password] = 17acdc1ee8e4ed05e9d27fce4df6d4b5de036910
[email] = tes...@admin.com
[country_id] = 180
[captcha_input] = uhrfca
[reg_ip] = 172.16.5.73
[confirm_code] = 4c526005-2038-4c84-b01f-0ccec0a8061f
)

[UserProfile] = Array
(
[birth] = 2009-02-12
)

), and mysql ENGINE is MyISAM , anyone know the reason ?  help me !!!

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: calling model function from controller.

2010-07-28 Thread Jeremy Burns | Class Outfit
Let's assume we are dealing with the Post model.

In Post model:

function whatever() {
return Text;
}

From the posts controller:

$variable = $this-Post-whatever();

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Jul 2010, at 10:54, neeraj kumar wrote:

 hi all, i want to call a function defined in model from controller,
 which return simple text.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Phrase inflections

2010-07-21 Thread Jeremy Burns | Class Outfit
http://book.cakephp.org/view/953/Inflections

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 20 Jul 2010, at 18:36, desheffer wrote:

 I have a model called LeaveOfAbsence. The proper English name for the
 pluralized controller would be LeavesOfAbsence rather than
 LeaveOfAbsences (similar to the plural mothers-in-law).
 
 Does anyone know to set up inflections for this specific case? It
 seems that CakePHP only looks at the last word in the phrase, never
 the entire phrase.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Email Component

2010-07-21 Thread Jeremy Burns | Class Outfit
Have you tried clearing the cache (/app/tmp/cache/...and sub folders)?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Jul 2010, at 03:06, Hugo M wrote:

 Mm... if you have Linux you can check in /etc/php5/apache2/php.ini the 
 sendmail configuration and the sendmail path. Maybe is put as a relative path 
 (I don't see a good reason to do that but... who knows :P)
 
 2010/7/20 Ed Propsner crotchf...@gmail.com
 Nope, nothing. I originally used it right out of the box and I didn't have to 
 change a thing. 
 
 It was working perfectly until I changed to a new dir on my server. It really 
 makes no sense. 
 
 
 On Tue, Jul 20, 2010 at 8:49 PM, Hugo M ham1...@gmail.com wrote:
 Strange, do you have any configuration related with Email component? if I can 
 send mail with mail() I can send with the component :S
 
 2010/7/20 Ed Propsner crotchf...@gmail.com
 I recently changed names on one of my sites and moved the entire site to a 
 different dir on the server. 
 
 Everything went smooth enough except now I'm unable to send emails. 
 Mail sends ok using  PHP mail() function but not when using the email 
 component. 
 The email is NOT set up for SMTP.
 
 Am I overlooking something here? I'm not sure what the problem is.   
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Undefined property: View::$Session

2010-07-21 Thread Jeremy Burns | Class Outfit
What are you calling and what error are you getting?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Jul 2010, at 19:01, Abby wrote:

 I am getting this error when I am using check function. I have added
 Session to helper and component in my controller but that doesnt seem
 to help.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to find if findBy... is empty?

2010-07-20 Thread Jeremy Burns | Class Outfit
$jobstatus = 
$this-Jobstatus-findByTrackingno($this-data['Jobstatus']['track']));

if (empty($jobstatus):
do something;
else:
do something else;
endif;

$this-set('jobstatus', $jobstatus);

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 19 Jul 2010, at 07:20, Louie Miranda wrote:

 I have this code:
 
 $this-set('jobstatus', 
 $this-Jobstatus-findByTrackingno($this-data['Jobstatus']['track']));
 
 I was wondering how can I know if findByTrackingno is empty? So I could 
 trigger an error without displaying the view?
 
 Thanks
 --
 Louie Miranda
  - Email: lmira...@gmail.com
  - Web: http://www.louiemiranda.com
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: cakephp email component

2010-07-20 Thread Jeremy Burns | Class Outfit
It is so hard to help you with questions like this when we don't know what's 
going wrong. Can you be more specific? Can you paste an error message?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 19 Jul 2010, at 08:12, fadhli - wrote:

 ?php
 class MessagesController extends AppController {
 
   var $name = 'Messages';
 var $components = array('Email');
 
 function _sendNewMessage($id) {
 $message = $this-Message-read(null,$id);
 
 $this-Email-to = $message['Client']['email'];
 $this-Email-bcc = array('fad...@c-artsmag.com');
 $this-Email-subject = 'Welcome to our really cool thing';
 
 $this-Email-replyTo = 'supp...@example.com';
 $this-Email-from = 'Cool Web App a...@example.com';
 
 $this-Email-template = 'simple_message'; // note no '.ctp'
 //Send as 'html', 'text' or 'both' (default is 'text')
 $this-Email-sendAs = 'both'; // because we like to send 
 pretty mail
 
 //Set view variables as normal
 $this-set('message', $message);
 //Do not pass any args to send()
 $this-Email-send();
 }
 
 
   ...
 ...
 ...
 
   function add() {
   if (!empty($this-data)) {
   $this-Message-create();
   if ($this-Message-save($this-data)) {
 $this-_sendNewMessage( $this-Message-id );
 
   $this-Session-setFlash(sprintf(__('The %s has 
 been saved', true), 'message'));
   $this-redirect(array('action' = 'index'));
   } else {
   $this-Session-setFlash(sprintf(__('The %s 
 could not be saved. Please, try again.', true), 'message'));
 
   }
   }
   $users = $this-Message-User-find('list', 
 array('fields'=array('User.id', 'User.username')));
   $clients = $this-Message-Client-find('list');
 
   $this-set(compact('users', 'clients'));
   }
 ...
 ...
 ...
 }
 
 ?
 
 
 
 
 I use the cakephp 1.3.0 and yahoo web hosting.
 i write the code above to send email, but it does not work properly. anyone 
 can help me so this method works well.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: setFlash not displaying

2010-07-16 Thread Jeremy Burns | Class Outfit
Which version of Cake are you using?

There's no need to check for the presence of a message; -flash() takes care of 
that for you.

On 1.3:
echo $this-Session-flash();

On 1.2:
$this-Session-flash();

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jul 2010, at 05:58, StephenE wrote:

 
 Hello, newbie here.  I cannot get setFlash() to display a message on
 my view page.
 
 In the controller:
 
 $this-Session-setFlash('Please enter the correct number.',
 'register', array('class' = 'error-message'));
 
 In the view page register.ctp:
 
 ?php if ($session-check('Message.flash')) { $session-flash();}?
 
 This seems so simple.  What am I doing wrong?  Thanks for the help!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: CakePHP 1.3 Form Helper creating drop down and not input field

2010-07-16 Thread Jeremy Burns | Class Outfit
The form helper will automatically create a drop down is there is a variable 
that is a plural of a field name without it's '_id' at the end.

For example, if you set a variable called $towns in your controller populated 
by $this-Town-find('list'); and then have a form input called town_id, Cake 
will link them up and make a drop down called town_id populated with the 
contents of the $towns array.

I can only presume that you have one such variable that matches a field name, 
and the rest don't.

What is your desired outcome? Should they all be drop downs (in which case 
you'll need to set the array variables in your controller) or should they all 
be inputs (in which case you should add the 'type' = 'text' option to your 
form input).

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jul 2010, at 15:14, spheroid wrote:

 I have a database table that contains child records of another table
 and want users to be able to change those child records. The form
 helper is doing something strange. I have it loop through my fields
 which are varchar, and for some reason one field is creating a select
 drop down, all others an input. Why is this happening and how can I
 fix it?
 
 Portion of my view:
 
 echo $form-input($somestring['MyTableName']['fieldname'], array(
'div' = false,
'label' = $somestring['MyTableName']
 ['fieldname_text'],
'before' = 'trtd style=width:250px;',
'between' = ': */tdtd',
'after' = '/td/tr',
'size' = 65,
'default' = $somestring['MyTableName']['setting']
));
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Connecting two tables with diffrent/ special key

2010-07-16 Thread Jeremy Burns | Class Outfit
Got it. Can I make a suggestion? This suggests poor data integrity as child 
records (favs) can exist after the parent record (products) have been deleted. 
Would it not be better to mark a product as 'deleted' rather than actually 
deleting it?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jul 2010, at 15:21, brototyp wrote:

 @Jeremy: Normally these Fields would be the same. But the Product
 table is changing every day. And if a product is gone, I need the
 Information the favs table (That a user added a pruduct to his favs,
 which isn't there anymore), so I can't just join these two tables.
 
 @Master Ram: Thanks for your answer, I tried Sams solution, but Im
 sure your is working also.
 
 @Sam: Thanks Sam solution seems to work. I added in my Fav Model:
 
 var $belongsTo = array(
'Product' = array(
'className' = 'Product',
'foreignKey'= false,
'conditions'= 'Product.zupid = Fav.zupid'
)
 
 and all information shows up.
 
 What doesn'T work so far is connecting the Product to Favs table. My
 code gets interrupted by adding this:
 
 In your Product model...
 var $hasMany = array(
'Fav' = array(
'className' = 'Fav',
'foreignKey'= false,
'conditions'= 'Product.zupid = Fav.zupid'
)
 
 I will try some more time. And if it doesn'T work, I will come back to
 you.
 
 Thanks guys for your help, App it.
 
 Best,
 Björn
 
 
 
 
 
 
 On 13 Jul., 07:02, Sam s...@masterscommission360.com wrote:
 Assuming your favs table produces a Fav model(note, I haven't tested
 this but it *should* work)
 In your Fav model...
 var $belongsTo = array(
 'Product' = array(
 'className' = 'Product',
 'foreignKey'= false,
 'conditions'= 'Product.zupid = Fav.zupid'
 )
 
 In your Product model...
 var $hasMany = array(
 'Fav' = array(
 'className' = 'Fav',
 'foreignKey'= false,
 'conditions'= 'Product.zupid = Fav.zupid'
 )
 
 On Jul 12, 6:56 pm, brototyp b.geh...@gmail.com wrote:
 
 Hi guys, I'm pretty new in Cake and I have an issue with connecting
 two tables.
 
 I have a product table (product) with:
 
 id (auto increment), zupid (a unique product id key), productname,
 product_id, product price  .
 
 and an other table (favs) with:
 
 id (auto increment), zupid, user_id, stats.
 
 Now I would like to connect those tables somehow with zupid as key (it
 has to be zupid).
 The reason for connecting is, that I want to have all product data
 when accessing the fav table in the favs view.
 So far, I only get the data from the favs table.
 
 Thanks in advance!
 Best,
 b
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: alt tag for text box

2010-07-15 Thread Jeremy Burns | Class Outfit
I'm happy to be corrected, but I think the 'alt' tag only exists for images 
(that's HTML, not Cake).

Also interested to see you using inline styles - are you not using CSS?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 15 Jul 2010, at 11:42, Master Ram wrote:

 Hi,
 
 how to set alt tag for text box, in cakePHP.
 
 i used like this.
 ?php e($form-text('contact_name', array('alt' = 'Contact Name',
'value' = '',
'style' = 'width: 80%')));
?
 
 its not working .
 
 where i missed out.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: function problem in controller

2010-07-14 Thread Jeremy Burns | Class Outfit
$this-text();

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Jul 2010, at 07:15, Master Ram wrote:

 Hi. to all
 
 in my controller i am using one function.
 
 function text() {
 
 ;;; 1000 lines of code
 ;;;
 }
 
 function add() {
 
 //Here i want same code. is having in text function. it is possible to
 call text() here.
 
 // i want to reduce the code.
 
 }
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: applying css to form input fields

2010-07-14 Thread Jeremy Burns | Class Outfit
You probably just need to tweak the CSS using display: inline and so on.

What does the HTML output look like? It'll be easier to advise once we see that.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Jul 2010, at 10:43, Tomfox Wiranata wrote:

 hi,
 
 i am trying to pimp up my forms with css. but it seems a little more
 difficult with cake. technically i wanna have my login form close to
 facebook. elements side by side
 
 username - inputfield  password - inputfield
 remember me   forgot password?
 
 
 i know it works like that:
   echo $form-input('username',  array(
   'label' = 'Login',
   'div'='formfield',
   'error' = array(
   'wrap' = 'div',
   'class' = 'formerror'
   )
   ));
 
 
 but this formats my label and inputfield..i want it to format
 separately..and i cant get the above mentioned order done.. i always
 get the elements one below the other...
 
 username
 inputfield
 
 password
 inputfield
 
 how can i do that? thx :)
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: applying css to form input fields

2010-07-14 Thread Jeremy Burns | Class Outfit
View page source in your browser.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Jul 2010, at 10:54, Tomfox Wiranata wrote:

 hi jeremy,
 
 is there a feature that show how it looks in html?
 
 On 14 Jul., 11:48, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 You probably just need to tweak the CSS using display: inline and so on.
 
 What does the HTML output look like? It'll be easier to advise once we see 
 that.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 14 Jul 2010, at 10:43, Tomfox Wiranata wrote:
 
 hi,
 
 i am trying to pimp up my forms with css. but it seems a little more
 difficult with cake. technically i wanna have my login form close to
 facebook. elements side by side
 
 username - inputfield  password - inputfield
 remember me   forgot password?
 
 i know it works like that:
echo $form-input('username',  array(
'label' = 'Login',
'div'='formfield',
'error' = array(
'wrap' = 'div',
'class' = 'formerror'
)
));
 
 but this formats my label and inputfield..i want it to format
 separately..and i cant get the above mentioned order done.. i always
 get the elements one below the other...
 
 username
 inputfield
 
 password
 inputfield
 
 how can i do that? thx :)
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: applying css to form input fields

2010-07-14 Thread Jeremy Burns | Class Outfit
So I guess you need to apply some style to div.loginfield label and 
div.loginfield input[type=text]. Perhaps make them display: inline for a 
start and give the label a width?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 14 Jul 2010, at 11:02, Tomfox Wiranata wrote:

 of course ^^
 
 here you go :)
 
 form id=UserLoginForm method=post action=/muh/users/login
 accept-charset=utf-8
 div style=display:none;input type=hidden name=_method
 value=POST //div
 
 div class=loginfield requiredlabel
 for=UserUsernameBenutzername/label
 input name=data[User][username] type=text maxlength=50
 id=UserUsername //div
 div class=loginfield requiredlabel for=UserPwPasswort:/
 labelinput type=password name=data[User][pw] id=UserPw //
 div
 
 input type=hidden name=data[User][remember_me]
 id=UserRememberMe_ value=0 /
 input type=checkbox name=data[User][remember_me] value=1
 id=UserRememberMe /label for=UserRememberMeRemember Me/label
 
 div class=submitinput type=submit value=Login //div/form
 
 On 14 Jul., 11:55, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 View page source in your browser.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 14 Jul 2010, at 10:54, Tomfox Wiranata wrote:
 
 hi jeremy,
 
 is there a feature that show how it looks in html?
 
 On 14 Jul., 11:48, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 You probably just need to tweak the CSS using display: inline and so on.
 
 What does the HTML output look like? It'll be easier to advise once we see 
 that.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 14 Jul 2010, at 10:43, Tomfox Wiranata wrote:
 
 hi,
 
 i am trying to pimp up my forms with css. but it seems a little more
 difficult with cake. technically i wanna have my login form close to
 facebook. elements side by side
 
 username - inputfield  password - inputfield
 remember me   forgot password?
 
 i know it works like that:
echo $form-input('username',  array(
'label' = 'Login',
'div'='formfield',
'error' = array(
'wrap' = 'div',
'class' = 'formerror'
)
));
 
 but this formats my label and inputfield..i want it to format
 separately..and i cant get the above mentioned order done.. i always
 get the elements one below the other...
 
 username
 inputfield
 
 password
 inputfield
 
 how can i do that? thx :)
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: cake 1.3.2 wants to be too smart

2010-07-14 Thread Jeremy Burns | Class Outfit
I don't know if this would work for you and your set up, but could you populate 
and set the timestamp from within Cake using the date() function instead of 
relying on the database?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 15 Jul 2010, at 05:26, djogo wrote:

 
 Yes, this kind of suck. I wanted to have both created_at and
 updated_at fields, which I remember being trivial at mysql, but cake
 doesnt allow you to:
 
 - have two or more timestamp fields
 - name your timestamp field whatever you want
 
 
 
 
 On 13 jul, 04:11, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote:
 That's not what I'm asking about. Lets say I NEED to use TIMESTAMP and
 CURRENT_TIMESTAMP as default value, and in that case cakePHP
 misbehaves.
 
 On Jul 13, 7:04 am, Walther waltherl...@gmail.com wrote:
 
 
 
 I've never seen that problem before...
 
 Cake offers the same functionality, it is well documented in every
 book. Basically you crater a field called created or updated as a
 datetime, default null and cake will populate it automatically.
 
 On Jul 12, 5:02 pm, Grzegorz Pawlik grzegorzpaw...@gmail.com wrote:
 
 just switching from 1.3.0 to 1.3.2 got me into trouble, when I have
 field specified as:
 
   `updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
 
 and don't supply any value for that field in array I try to save ,
 neither a key in
 1.3.0 it's working as desired - I get current timestamp in that field,
 but
 1.3.2 tries looks that's it not null field, and read default value
 (CURRENT_TIMESTAMP) ant unfortunatelly polupulates this array with
 that pair of key/val:
 createt_at=CURRENT_TIMESTAMP
 which is basically stupid for two reasons, I think:
 1. It tries to duplicate database mechanisms which are working just
 fine (when no value - use default value, no need to to that:
 if no value, check what's default value defined in database and
 explicitly save data with that value)
 2. It makes CURRENT_TIMESTAMP not working
 
 is there a way to turn that behavior off?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Problem with deleting record

2010-07-14 Thread Jeremy Burns | Class Outfit
See this thread: 
http://groups.google.com/group/cake-php/browse_thread/thread/94b90f0a9a0cdfd1/7ccde5a6f8f86f95?hl=enlnk=gstq=back+button#7ccde5a6f8f86f95

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 15 Jul 2010, at 05:38, vanishri wrote:

 Hi All,
 
 I have an applicetion developed using cake php.
 
 in which we can add,delete,and update the data.
 
 once i view and  delete any record it will delete from database ,but
 once clicking browser's back button it reloads the deleted record's
 data.
 
 kindly let me know the solution.
 
 thansk in advance
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: when and why using different models/controllers?

2010-07-13 Thread Jeremy Burns | Class Outfit
A spot on reply. A broad brush to view it is to start from the database and 
create a model/controller/views for each table. That will take you pretty near 
where you want to go, and then you can start to combine things together.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Jul 2010, at 10:16, nurvzy wrote:

 Ok, so the issue here is you're still thinking about your website/app
 as a basic procedural script.  Which isn't that hard to do, as that is
 kind of the life cycle of a standard HTTP request.  However, the trick
 here is to stop thinking about your website as your basic php
 procedural script, and start thinking of it in an Object Oriented
 manner.  This can be a tough thing to wrap your head around at first.
 It was for me, and everyone other developer I've talked to.  It's an
 odd thing, eventually it will all just click, like a light goes on
 above your head, and at least for me it was rather sudden.
 
 I mean by Object Oriented, is thinking about the various actions,
 logic, and data types you want your website to manager/show/manipulate
 and describe them as objects in your mind.  What can a User do,
 (register, login, logout, view past orders, etc...)?  What can a Post
 do (create, edit, show most recent, etc...)?  What can a Download do
 (stream the content, share to facebook, etc...)?  These 'actions' that
 you can preform on an object will be your various functions.   Now
 that you've described all the objects in your application its now time
 to convert those objects into Models.  A model, in most cases, is a
 singular form of your object and is really in charge of handling all
 the data needed to describe that object (User, Post, Download).
 Controllers are the plural form of your objects, used to manage/
 combine/format groups of objects for various uses (Users, Posts,
 Downloads).
 
 So, to answer your question, if you're describing something new, its
 best practice to create another model/controller pairing for the new
 object.  The beauty if CakePHP is the extreme ease it gives us to
 associate objects together.  This helps us make some really complex
 and intricate data structures from many smaller objects all put
 together.
 
 I hope that helps,
 Nick
 
 On Jul 13, 1:53 am, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 hi,
 
 so far i used one controller/model for the whole user management
 (login, logout, register, profile etc.).
 
 now I am heading to a different milestone with my website, and the
 user is not in focus anymore. so it makes sense to create a new
 controller/model, right? but that seems more like a logical/
 philosophical thing to me.
 
 i guess technically it does not matter if i use 1 controller/model for
 all or different ones. is that right? if not, when should i use
 different ones?
 
 thx :)
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Too many SQL queries!!

2010-07-13 Thread Jeremy Burns | Class Outfit
Out of interest, what is your debug level?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Jul 2010, at 10:57, Alex Bovey wrote:

 Hi Nick,
 
 Thanks for the reply.
 
 Sorry I should have said in my original post - I'm already using Containable 
 AND setting recursive to -1 in app_model.php.
 
 But still the selects are incredibly inefficient - a single query to fetch 
 each individual row?!
 
 I'm not specifying 'fields' but surely that's not going to mean the 
 difference between what should be 2 queries at most, and the thousands I'm 
 ending up with...
 
 Thanks,
 
 Alex
 
 On Tue, Jul 13, 2010 at 9:59 AM, nurvzy nur...@gmail.com wrote:
 Use a mixture of:
 
 fields option key (so you're not retrieving data you don't intend to
 use),
 containable (so you're not selecting associative models and their
 fields you don't care about),
 and set recursive = -1 in your app_model.php
 
 The first thing I do whenever I start any new CakePHP project is open
 up app_model.php and add actsAs = array('Containable') and recursive =
 -1.
 
 I suggest you take advantage of the containable component.  Read about
 it here:
 http://book.cakephp.org/view/474/Containable
 
 Hope that helps,
 Nick
 
 On Jul 13, 2:35 am, Alex Bovey a...@bovey.co.uk wrote:
  Hi all,
 
  Using Cake 1.2.0.6311 I'm having real problems with the number of SQL
  queries in my app.
 
  For example, I have Enquiry belongsTo User and User hasMany Enquiry.
 
  A simple $this-Enquiry-find('all') results in one query to fetch the
  enquiries, and then a separate query for every single Enquiry to fetch the
  User for that Enquiry.
 
  When I have more complex model relations I'm ending up with over 10,000 SQL
  queries.
 
  What am I doing wrong?!
 
  Thanks,
 
  Alex
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 
 -- 
 Alex Bovey
 Web Developer | Alex Bovey Consultancy Ltd
 Registered in England  Wales no. 6471391 | VAT no. 934 8959 65
 a...@bovey.co.uk | t 0844 567 8995 | m 07828 649386 | f 0870 288 9533
 PHP | MySQL | AJAX | XHTML | CSS | Javascript | XML | W3C Accessibility
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Fatal error: Allowed memory size of 16777216 bytes exhausted

2010-07-13 Thread Jeremy Burns | Class Outfit
I'd also check your model associations and controller code to check that you 
are not in a recursive loop, retrieving too much data or have some other 
gotcha. IMO, I think it's better to get to and fix the root cause rather than 
just paper over it. If your memory is really being stretched, then you will not 
have optimum performance.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Jul 2010, at 12:58, Ayman Bedair wrote:

 This happened with me on the local windows server while testing,
 didn't really see the problem up on my live one.
 
 Anyway if u have access to the PHP.INI file you can just go there and
 edit the memory_limit = 16M value to something like memory_limit =
 50M. I had this set to 150MB and it didn't affect the computer
 stability so go up until it's sufficient for you app to run. (You need
 to restart your server after changing this value for the new settings
 to take effect)
 
 If this is not a convenient solution try setting the debug to 0 and
 the  var $persistModel = false; in your controllers. That should
 save up some of the memory space I believe.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Another model displayField

2010-07-12 Thread Jeremy Burns | Class Outfit
From within model1s_controller:

$this-Model1-Model2-find('list');

This assumes that Model1 and Model2 have $hasMany  $belongsTo relationships 
defined within them.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 12 Jul 2010, at 16:10, Samueljslg wrote:

 Hi Shaz, thanks for your help, but I need to show the field of another
 Model. To say the field name Model2.
 
 On 12 jul, 05:47, Shaz shazam...@gmail.com wrote:
 class Model extends AppModel {
 var $name = 'Model';
 var $displayField = 'name';
 
 }
 
 Change 'name' to whatever you want to be shown (i.e. 'title' etc)
 
 On 10 July, 20:58, Samueljslg samuelj...@hotmail.com wrote:
 
 
 
 Hello friends, I am starting with cakephp, I have a problem, you want
 to show it in the field of another list related model to work, as I
 do???. In the cake manual says The displayField attribute specifies
 which field in the database should be used as a label for the record.
 With the above I understand that if you can, so easy to define a
 variable, anyone knows . Or if I can do otherwise. I was watching
 the loadModel method (). Thanks.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Js helper advice needed

2010-07-12 Thread Jeremy Burns | Class Outfit
Perfect - thanks. Here's a summary of my final changes.

After the submit button (using the Js helper):
echo $this-Js-writeBuffer(array('inline' = true));

This also means I don't have to give the submit button an id.

My login action in the users controller is:
function login() {
Configure::write('debug', 0);
$this-render('login', 'ajax');
}

And everything is working as expected.


Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 11 Jul 2010, at 20:27, nurvzy wrote:

 This was an issue I ran into while doing an ajax shopping cart.  The
 form element that is returned via AJAX needs to have echo $js-
 writeBuffer() in it as well.  Alternatively, you can specify that the
 jshelper not buffer the javascript and instead output it as you call
 it (AjaxHelper style).
 
 That solved my issue, and hope it helps you,
 NIck
 
 On Jul 11, 4:22 am, Jeremy Burns jeremybu...@classoutfit.com wrote:
 I have a view that contains an element for logging in. The key bits
 are inside a div with an id of 'login'. The login form's submit button
 is created using the Js helper:
 
 echo $this-Js-submit(
 'Login',
 array(
 'update' = '#login',
 'url' = array(
 'controller' = 'users',
 'action' = 'login'
 ),
 'id' = 'sbt_login'
 )
 );
 
 I have given the button an id so that any Javascript created will
 reference that, rather than a random number.
 
 When the view is rendered, this is the HTML for the form:
 
 div id=login
 h3Login/Register/h3
 form controller=users id=UserLoginForm method=post action=/
 users/login accept-charset=utf-8
 div style=display:none;
 input type=hidden name=_method value=POST /
 /div
 label for=UserUsernameUsername/label
 input name=data[User][username] type=text 
 id=UserUsername /
 label for=UserPasswordPassword/label
 input type=password name=data[User][password]
 id=UserPassword /
 div class=submit
 input id=sbt_login type=submit value=Login /
 /div
 /form
 /div
 
 Using $this-Js-writeBuffer, the following script is added to the
 body:
 
 script type=text/javascript
 //![CDATA[
 $(#sbt_login).bind(click, function (event) {$.ajax({data:$
 (#sbt_login).closest(form).serialize(), dataType:html,
 success:function (data, textStatus) {$(#login).html(data);},
 type:post, url:\/users\/login});
 return false;});});
 //]]
 /script
 
 So far so good. Clicking the 'Log in' button triggers the login
 methods of the users controller using ajax and refreshes the contents
 of the 'login' div.
 
 Assuming that the login failed, the login form is redrawn, along with
 an error message. The HTML is exactly the same. This time however,
 clicking the login button does not use ajax, so the whole page is
 replaced with just the contents of the login div.
 
 One way around this is to not include the login submit button in the
 HTML that is refreshed via ajax. The problem with this is that if the
 login is successful, the login button should disappear, which of
 course it won't.
 
 I could do all of this with straightforward javascript, but that sort
 of misses the point of having the Js helper.
 
 What am I doing wrong, what is the right way to do this and are there
 any examples out there?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Connecting two tables with diffrent/ special key

2010-07-12 Thread Jeremy Burns | Class Outfit
Before spending loads of time on this, wouldn't Product.id and Fav.product_id 
be the same? Why can't you just join on these fields?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 13 Jul 2010, at 01:56, brototyp wrote:

 Hi guys, I'm pretty new in Cake and I have an issue with connecting
 two tables.
 
 I have a product table (product) with:
 
 id (auto increment), zupid (a unique product id key), productname,
 product_id, product price  .
 
 and an other table (favs) with:
 
 id (auto increment), zupid, user_id, stats.
 
 
 Now I would like to connect those tables somehow with zupid as key (it
 has to be zupid).
 The reason for connecting is, that I want to have all product data
 when accessing the fav table in the favs view.
 So far, I only get the data from the favs table.
 
 Thanks in advance!
 Best,
 b
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: set($data) dosen´t work

2010-07-10 Thread Jeremy Burns | Class Outfit
Doing it like that they'd be numeric wouldn't they? In other words, 
$this-data[0] would equal 'kat_checkboxes'.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Jul 2010, at 18:35, Davor Ilic wrote:

 i use it like this:
 
 
   
   $data = array(
   'kat_checkboxes', $this-Kat-find('all'),
   'pmedia_checkboxes', 
 $this-Productmedia-find('all')
   );
   
   $this-set($data);
 
 and in the view he tell me that the vars kat_checkboxes and pmedia_checkboxes 
 doesn´t exist...
 
 did id do something wrong by creating the set array?
 
  
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Weird Core Problem with Cake1.3.2

2010-07-09 Thread Jeremy Burns | Class Outfit
Not sure I can really help, but the white screen of death when debug = 0 is the 
sign of a bug that is stopping the site processing. Changing it to 1 or 2 lets 
it go on either to display the error or in some cases move past it and work.

I think /app/webroot/index.php changed between 1.2 and 1.3 - are you using the 
new version and have you completed the rest of the migration steps?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Jul 2010, at 16:32, euromark wrote:

 We are heaving the weirdest problems after updating to from 1.2 to
 1.3.2 on our business server!
 The project works fine on local Windows as well as on a debian test
 server (root server). Both with debug 0 and debug 2.
 
 But on the live server it works only in debug 2.
 Everything is the same - only that it is a managed root server.
 Cake1.2 worked fine, but now only it only runs in debug 2. As soon as
 you switch to productive mode (debug 0), the website dies without
 displaying anything (white screen of death).
 I managed to trace it down to
 
 $instance[0] = new Configure();
 $instance[0]-__loadBootstrap($boot);
 
 inside cake/libs/configure.php.
 After these 2 lines, the script comes to a total stop!
 
 This is very deep inside the cake core. So i wonder whats going wrong
 here.
 
 /app/webroot/index.php:
 
 if (function_exists('ini_set')  ini_set('include_path',
 CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS .
 PATH_SEPARATOR . ini_get('include_path'))) {
   define('APP_PATH', null);
   define('CORE_PATH', null);
 }...
 works!
 
 if (!include(CORE_PATH . 'cake' . DS . 'bootstrap.php')) {} now
 triggers configure.php - so the real dispatching is never invoked...
 
 any ideas? we worked 2 full days on the problem, and aren't any closer
 to a solution than before.
 we might need to switch back to 1.2 on this specific server, if
 everything fails..
 
 
 PHPversion: 5.2.11
 Server: Linux Custom Build 64bit prohost.de XEON SMP x86_64
 Configure Command  './configure' '--prefix=/usr/local/php5' '--
 with-config-file-path=/etc/php5' '--with-openssl' '--with-xsl' '--with-
 xmlrpc' '--enable-mbstring' '--enable-mbregex' '--enable-wddx' '--with-
 gettext=/usr' '--with-mysql=/usr/local/mysql' '--with-mysqli=/usr/
 local/mysql/bin/mysql_config' '--with-mcrypt=/usr/lib64/' '--with-
 apache=../apache_current/' '--with-freetype-dir=/usr/local' '--with-
 t1lib=/usr/local' '--with-gd' '--enable-gd-native-ttf' '--with-jpeg-
 dir=/usr/local' '--enable-exif' '--with-png-dir=/usr/local/lib' '--
 with-zlib' '--with-curl' '--enable-bcmath' '--enable-calendar' '--
 enable-discard-path' '--enable-shared' '--enable-force-cgi-redirect'
 '--with-pdo-mysql=/usr/local/mysql' '--enable-soap'
 Server API  Apache
 Virtual Directory Support  disabled
 Configuration File (php.ini) Path  /etc/php5
 Loaded Configuration File  /etc/php5/php.ini
 Scan this dir for additional .ini files  (none)
 additional .ini files parsed  (none)
 PHP API  20041225
 PHP Extension  20060613
 Zend Extension  220060519
 Debug Build  no
 Thread Safety  disabled
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Session-setFlash error

2010-07-09 Thread Jeremy Burns | Class Outfit
If you are on 1.3, don't forget to add the Session helper and Session component 
to your app_controller.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Jul 2010, at 20:51, gautam lakum wrote:

 I am getting this error in my default.ctp layout.
 
 
 Notice (8): Undefined variable: session [APP\views\layouts
 \default.ctp, line 74]
 Code | Context
 
 Fatal error: Call to a member function flash() on a non-object in C:
 \wamp\www\rentcar1\app\views\layouts\default.ctp on line 74
 
 This is the layout html I have written.
 
 div class=span-24 last style=width:100%;text-
 align:right;background:#F18235;color:#ff;
 ?php $session-flash(); ?
 
 
 Please help. I am not getting what is happening there?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: can't retrieve data from a form

2010-07-08 Thread Jeremy Burns | Class Outfit
That's not Cake being fussy - it's HTML. The helper just does the heavy lifting 
of writing html for you, and a form has to open, contain elements and then 
close. Anything not inside the form will be ignored.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 8 Jul 2010, at 16:53, Tomfox Wiranata wrote:

 i did name the form and i accessed it correct...what i did wrong:
 
 obviously cake is sensitive about the order.. i had input, create
 submit...
 
 now it works...thx :)
 
 On 8 Jul., 16:32, Shaz shazam...@gmail.com wrote:
 The form needs to be created with a name and then it also needs to
 end:
 
 $form-create('FormName');
 $form-input( ... etc etc );
 $form-end('Submit');
 
 And you should be able to access your form data via $this-
 
 data['FormName'][ inputfield ].
 
 On Jul 8, 1:31 pm, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 
 hi,
 
 i am trying to extract data from a form to update user information.
 but somehow i cant extract the information from the form. i echo the
 current information in input fields. everything works fine. the
 echoing, the calling of my updateProfile function from my view:
 
 span class=profiledata?php   echo $form-input('created',
 array('value' = $user['created']));   ?/span
 
 ?php echo $form-create('User', array('action' = 'updateProfile'));?
 
 div class=button ?php echo $form-button('Sichern', array('type'
 = 'submit'));?  /div
 
 my function that updates the given info
 
  function updateProfile()
  {
 
 $updates = 
 $this-User-findByUsername($this-Session-read('User.username'));
 
 WORKS - $updates['User']['firstname']= 
 'Trötde';
 WORKS - 
 $updates['User']['lastname']='tröter';
 sends NULL -  
 //$updates['User']['username']=$this-data['User']
 ['username'];
 sends NULL - 
 $updates['User']['created']=$this-data['User']
 ['created'];
 
 if ( $this-User-save($updates)){
 $this-Session-setFlash('Profil 
 aktualisiert');
 $this-redirect(array('controller' = 
 'users', 'action' =
 'profile'));
 }
 else{
 $this-Session-setFlash('Speichern 
 fehlgeschlagen');
 $this-redirect(array('controller' = 
 'users', 'action' =
 'editprofile'));
 }
 
  }
 
 now if i set values as string, like trötde above, it works. so the
 saving process is correct. but if i wanna get the data from the form
 with $this-data['User']['created'] the value is null..
 
 can u see the problem ?? thx :)
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Webshop in CakePHP

2010-07-08 Thread Jeremy Burns | Class Outfit
There is also Kaching - http://github.com/mfriesen/kaching-php

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 8 Jul 2010, at 21:49, Emil Christensen wrote:

 Thanks for the inputs. I'll take a look. ;)
 
 On 8 July 2010 20:39, mike karthauser mi...@brightstorm.co.uk wrote:
 I've been looking at vam cart recently to replace an oscommerce store without 
 going down the magento route. 
 
 Vam cart looked well specced but I was a little cautious when looking at the 
 demo as there were no products in it. Having spent sometime on bakesale a 
 while back, I'm very wary of adopting  a web app which doesn't have an active 
 developers community. Magento has that in spades but seems like a very big 
 hammer to crack an often tiny walnut.
 
 Mike Karthauser
 Brightstorm limited
 Tel: 07939252144
 
 On 8 Jul 2010, at 18:23, Andrey Mozharovsky mozharov...@gmail.com wrote:
 
 Did you see VamCart http://vamcart.com ?
 
 2010/7/8 euromark dereurom...@googlemail.com
 maybe you did :)
 
 http://cakeforge.org/projects/bakesale/
 
 
 On 8 Jul., 17:10, Emil Christensen christensen.e...@gmail.com wrote:
  Hi,
 
  Does anyone know of a sample/tutorial webshop build in CakePHP?
 
  I tried google without luck - maybe I'm searching for the wrong thing :)
 
  Thanks in advance.
 
  /Emil
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 
 -- 
 With the best regards,
 Andrey
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Can Cake do this?

2010-07-08 Thread Jeremy Burns | Class Outfit
Cake is a programming language (well, PHP is), not an off the shelf 
application. It's abilities are - more or less - limited by your imagination, 
talent and hard work. Nothing that you mention here seems at all unreasonable 
(difficult, even), unless you expect it all to be there for you out of the box.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Jul 2010, at 03:50, Bill P. wrote:

 ok, great. 
 Every framework sounds great and makes it sounds liek it can do anything, 
 until you actualy try to get it to work. 
 thanks for the feedback.
 I will continue with the manual and tutorials.
 Thanks
 
 
 
 From: Shaz shazam...@gmail.com
 To: CakePHP cake-php@googlegroups.com
 Sent: Thu, July 8, 2010 10:42:45 AM
 Subject: Re: Can Cake do this?
 
 Easily doable in CakePHP - it may take you a week or two to get around
 to Cake's way of doing things but stick with it.
 
 On Jul 7, 2:47 am, maxarbos maxar...@yahoo.com wrote:
  I am just getting into learning about cake and wanted to know if I am
  going to be able to do the things I am hoping it can do, easily.
 
  The site I am going to use this for is a product rental agency. They
  have a number of categories with unlimited levels of parent to child
  relationships. Prices can be specific to three different categories
  (by 3 hours, by day, and by week)
 
  I would also like to be able to allow them to have a shopping carts of
  sorts that is mainly a shopping list.
 
  A site administrator would be able to add categories (with pictures of
  the categories) products with pics, change prices, etc..
 
  SEO friendly URLs is a must as well.
 
  this all sounds pretty basic, so I am hoping this is all pretty
  standard and possible.
 
  thanks.
  Bill
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Database associations

2010-07-08 Thread Jeremy Burns | Class Outfit
You can use the join statement: 
http://book.cakephp.org/view/1047/Joining-tables )although it's not ideal).

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 9 Jul 2010, at 00:06, Justin Beeler wrote:

 I'm working with two tables:  Contacts and Calls.
 
 I want to join the calls with the contacts on a field called
 number (the phone number).  Is there not a way in cake to manually
 join tables and not have it join on a field like [model]_id ?
 
 If you need any further details, let me know.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Fatal error: Call to undefined method ThemeView::RenderElement()

2010-07-07 Thread Jeremy Burns | Class Outfit
http://book.cakephp.org/view/1566/View-and-Helpers

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 7 Jul 2010, at 05:58, arif hossen wrote:

 
 Dear Experts,
 
 I need help. i got below this problem when i have added renderElement in my 
 layout. I have also keep my file into views/elements folder. After add this 
 file below error occurs.
 
 Fatal error: Call to undefined method ThemeView::RenderElement() in 
 /opt/lampp/htdocs/arifhossen_rural/app/views/layouts/default.ctp on line 72
 
 
 Pls help how i can solve this error
 
 -- 
 Regards,
 Mohammad Arif Hossen
 Software Enginner at
 Epsilon Consulting and Development Services(ECDS)
 www.ecds-tech.com
 www.arifhossen.wordpress.com
 +88 01714355911 
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Bake, Missing database table error.

2010-07-05 Thread Jeremy Burns | Class Outfit
It is assuming that ApplicantsGuardian is part of a $hasAndBelongsToMany 
relationship between Applicants and Guardians. Rename it ApplicantGuardian and 
try again.

Sent from my iPad

On 5 Jul 2010, at 10:58, Sid saeed.bh...@gmail.com wrote:

 Hi,
 
 I am trying to bake the models, controller and views based on some
 tables I have created in a MySQL database. I have followed CakePHP's
 table naming conventions, ie named the tables in their plural form.
 However when I try bake all, it works for some tables but it is giving
 a weird error for some tables;
 
 Use Database Config: (default/test)
 [default]  default
 Possible Models based on your current database:
 1. ApplicantsGuardian
 2. Application
 3. Assessment
 4. Brother
 5. EntryRequirement
 6. FeePayment
 7. Fee
 8. Guardian
 9. Interview
 10. School
 11. Student
 12. YearGroup
 Enter a number from the list above,
 type in the name of another model, or 'q' to exit
 [q]  11
 Error: Missing database table 'applicants' for model 'Applicant'
 
 I don't know where it is getting 'applicants' from?
 
 Appreciate any help.
 
 Many thanks,
 
 Sid.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: ERROR: Notice (8): Undefined index: User [APP\views\users\profile.ctp, line 25]- can't find the problem

2010-07-04 Thread Jeremy Burns | Class Outfit
My advice with all of these sort of issues is to debug out the results of the 
array you are parsing. It then becomes really easy to see what syntax you need 
to get to the right data:

die(debug($your_variable));

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 4 Jul 2010, at 18:27, Tomfox Wiranata wrote:

 oki...i just embarrassed myself...
 
 delete ['User'] and it works^^
 
 On 4 Jul., 18:58, Tomfox Wiranata tomfox.wiran...@gmail.com wrote:
 hi,
 
 i try to retrieve user data and echo it in a view.
 
 my view:
 table
 tr
 thname/th
 
 /tr
 
 ?php foreach ($users as $user):  ?
 
 tr
 td?php echo $user['User']['firstname']; ?/td
 line 25 
 /tr
 ?php endforeach;  ?
 
 /table
 
 controller:
 function profile()
 {
 $this-set('users', 
 $this-User-findByUsername($this-Session-read('User.username')));
 
 }
 
 its drivin me nutsi dont think i did sth different from the blog
 example ??
 
 thx so much
 
 btw: the sql-statement is correct. it returns the value i need.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Unnecessary Queries??

2010-07-04 Thread Jeremy Burns | Class Outfit
What debug level are you using? See /app/core.php = Configure::write('debug', 
2);

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 5 Jul 2010, at 02:36, clearflysyst...@googlemail.com wrote:

 Hi Bakers,
 
 I have a simple reordering script setup -
 Very Basic Data Array -
 [Product] = Array(
[0] = Array(
   ['id'] = 6,
   ['sort_order'] = 1
),
[1] = Array(
   ['id'] = 7,
   ['sort_order'] = 2
),
etc..
 )
 
 Then Saving the data:
 foreach($this-data['Product'] as $product){
   $this-Product-save($product);
 }
 
 When saving this data cake is executing 3 Count queries for each
 'Product' and i can't figure out why the hell it even needs to execute
 one of them let alone the same query 3 times.
 
 2 SELECT COUNT(*) AS `count` FROM `products` AS `Product` WHERE
 `Product`.`id` = 6
 3 SELECT COUNT(*) AS `count` FROM `products` AS `Product` WHERE
 `Product`.`id` = 6
 4 SELECT COUNT(*) AS `count` FROM `products` AS `Product` WHERE
 `Product`.`id` = 6
 5 UPDATE `products` SET `id` = 6, `sort_order` = 1 WHERE
 `products`.`id` = 6
 
 So reordering say 10 items produces 40 Queries.
 
 Using saveAll instead of save actually produces another Count Query
 for each row (so saveAll on 10 items ends up with 50 Queries) hence
 the foreach method.
 
 Product Recursive = -1.
 
 Product relationships:
   public $belongsTo = array(
   'Category' = array(
   'className' = 'Category',
   'foreignKey' = 'category_id'
   )
   );
   public $hasMany = array(
   'Image' = array(
   'className' = 'Image',
   'foreignKey' = 'product_id',
   'dependent' = true,
   'exclusive' = true
   ),
   'ProductBid' = array(
   'className' = 'ProductBid',
   'foreignKey' = 'product_id',
   'dependent' = true,
   'exclusive' = true
   )
   );
 
 Any ideas as to why all the Unnecessary Queries or what i might be
 doing wrong?
 Thanks
 Simon
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Hide empty value in select box

2010-07-02 Thread Jeremy Burns | Class Outfit
A couple of thoughts...

What is in the $city array? This will be used to populate the select list, so 
if there's an empty row there, you'll get an empty row in the list.

Is there an option with an id of 1? If not, your default value might be messing 
things up a bit.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 2 Jul 2010, at 08:25, sherzo wrote:

 
 Hi all
 
 I have a selectbox like this
 
 $form-select('city_id',$city,  array ('empty'=false, 'selected'='1',
 'label'= false), array('label'=false, 'div'=false, 'name'='city_id',
 'id'='city_id'));
 
 I need to remove the empty option at the top of my options. I even set the
 ''empty'=false' but it not works!!!
 
 Can anyone help me please
 
 Thanks
 -- 
 View this message in context: 
 http://old.nabble.com/Hide-empty-value-in-select-box-tp29053216p29053216.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Hide empty value in select box

2010-07-02 Thread Jeremy Burns | Class Outfit
The guide says:

select(string $fieldName, array $options, mixed $selected, array $attributes)

There are only four attributes and you have five. Try:

$this-Form-select('city_id', $city, 1, array('empty' = true));

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 2 Jul 2010, at 08:56, sherzo wrote:

 
 Hi
 
 Here is the content of my array
 
 Array
 (
[4] = Adana
[2] = Ankara
[1] = Istanbul
[3] = Izmir
 )
 
 its wired!!!
 
 when I use  echo $form-select('city_id',$city,  array ('empty'= false),
 false, false);
 
 it doesnt show the empty space but it sends the city_id value as undefined
 !!!
 
 
 Jeremy Burns | Class Outfit wrote:
 
 A couple of thoughts...
 
 What is in the $city array? This will be used to populate the select list,
 so if there's an empty row there, you'll get an empty row in the list.
 
 Is there an option with an id of 1? If not, your default value might be
 messing things up a bit.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 2 Jul 2010, at 08:25, sherzo wrote:
 
 
 Hi all
 
 I have a selectbox like this
 
 $form-select('city_id',$city,  array ('empty'=false, 'selected'='1',
 'label'= false), array('label'=false, 'div'=false, 'name'='city_id',
 'id'='city_id'));
 
 I need to remove the empty option at the top of my options. I even set
 the
 ''empty'=false' but it not works!!!
 
 Can anyone help me please
 
 Thanks
 -- 
 View this message in context:
 http://old.nabble.com/Hide-empty-value-in-select-box-tp29053216p29053216.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 
 
 -- 
 View this message in context: 
 http://old.nabble.com/Hide-empty-value-in-select-box-tp29053216p29053405.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Hide empty value in select box

2010-07-02 Thread Jeremy Burns | Class Outfit
Stumped. I just tried exactly the same code and it worked as necessary.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 2 Jul 2010, at 09:18, sherzo wrote:

 
 Hi Jeremy
 
 thanks for the reply
 
 i used 
 $this-Form-select('city_id', $city, 1, array('empty' = false));
 
 and the empty space is still there!!! i really need to remove that space
 from the form %-| 
 
 
 Jeremy Burns | Class Outfit wrote:
 
 The guide says:
 
 select(string $fieldName, array $options, mixed $selected, array
 $attributes)
 
 There are only four attributes and you have five. Try:
 
 $this-Form-select('city_id', $city, 1, array('empty' = true));
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 2 Jul 2010, at 08:56, sherzo wrote:
 
 
 Hi
 
 Here is the content of my array
 
 Array
 (
   [4] = Adana
   [2] = Ankara
   [1] = Istanbul
   [3] = Izmir
 )
 
 its wired!!!
 
 when I use  echo $form-select('city_id',$city,  array ('empty'= false),
 false, false);
 
 it doesnt show the empty space but it sends the city_id value as
 undefined
 !!!
 
 
 Jeremy Burns | Class Outfit wrote:
 
 A couple of thoughts...
 
 What is in the $city array? This will be used to populate the select
 list,
 so if there's an empty row there, you'll get an empty row in the list.
 
 Is there an option with an id of 1? If not, your default value might be
 messing things up a bit.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 2 Jul 2010, at 08:25, sherzo wrote:
 
 
 Hi all
 
 I have a selectbox like this
 
 $form-select('city_id',$city,  array ('empty'=false, 'selected'='1',
 'label'= false), array('label'=false, 'div'=false,
 'name'='city_id',
 'id'='city_id'));
 
 I need to remove the empty option at the top of my options. I even set
 the
 ''empty'=false' but it not works!!!
 
 Can anyone help me please
 
 Thanks
 -- 
 View this message in context:
 http://old.nabble.com/Hide-empty-value-in-select-box-tp29053216p29053216.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google
 Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this
 group
 at http://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help
 others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google
 Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 
 
 -- 
 View this message in context:
 http://old.nabble.com/Hide-empty-value-in-select-box-tp29053216p29053405.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help
 others with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 
 
 -- 
 View this message in context: 
 http://old.nabble.com/Hide-empty-value-in-select-box-tp29053216p29053544.html
 Sent from the CakePHP mailing list archive at Nabble.com.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send

Re: making a layout with CSS in CakePHP

2010-07-02 Thread Jeremy Burns | Class Outfit
Your css files go in /app/webroot/css/. You include them by putting echo 
$this-Html-css(array('filename')); in the head section of your layout.

You do your data retrieval in the controller, although your function actually 
calls methods of the models, which do all of the database heavy lifting (e.g. 
$this-User-find('all'); - this is run from the users controller and talks to 
the user model).

You don't want to call profile.php as the action of the form -- use the form 
helper instead which calls the right controller/model combination. This is pure 
MVC stuff - it's different to doing usual php.

I'd recommend looking at the tutorial (http://book.cakephp.org/view/1528/Blog) 
because that will cover the bases.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 2 Jul 2010, at 16:29, Tomfox Wiranata wrote:

 hi,
 
 before i used cakephp i designed a layout with CSS naked (no
 framework, no CMS) to show a members profile. now, i am asking myself
 how to make this work in cakephp.
 
 this is what i got worked so far:
 
 i put all my divs containers into a view template:
 div class=frame
   div class=rightcolumn
   div class=databox
   div class=titleAllgemeines/div
   form action= method=post name=profile 
 id=profile
   div class=row
   span class=labelVorname/span
   span class=profiledata?php echo 
 $row['firstname'];?/span
   /div
 
   div class=row
   span class=labelNachname/span
   span class=profiledata?php echo 
 $row['name'];?/span
   /div
 
   div class=row
   span class=labelNickname/span
   span class=profiledata?php echo 
 $row['nickname'];?/span
   /div
 
   div class=row
   span class=labelMitglied seit/span
   span class=profiledata?php echo 
 $row['date_created'];?/
 span
   /div
   /form
   /div
 
   form action=profile.php method=post name=gotoEdit
 id=gotoEdit
   div class=buttoninput name=editProfile 
 type=submit
 id=editProfile value=Ändern //div
   /form
 
   /div
 
 /div
 /div
 
 now, where do i put my css file (where all the divs are defined)? is
 there a special folder for that? and where do i inlcude this file in
 my code to tell cake to use this specific css file?
 
 do i retrieve the user information for his profile in my controller?
 probably with the find method?
 do i put the code to print/show the information in my model?
 
 right now i am using a loop to show the data:
   div class=row
   span class=labelMitglied seit/span
   span class=profiledata?php echo 
 $row['date_created'];?/
 span
   /div
 
 but that wont work with cake
 
 so technically i dont know how to tell cake to use my css file, where
 (model or controller) to get the data from the table, and how/where to
 show the data (model or controller) that it appears in my divs
 
 any help would be great. thx s much
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Using Js helper on select list

2010-07-01 Thread Jeremy Burns
I have a select list that contains a list of currencies. When the user
changes the currency, I want to use the Js helper to refresh the cart,
which is presented inside a div in the same view. How do I do that?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: echoing data after retrieving it via find. cake doesn't echo the actual value, but rather array

2010-07-01 Thread Jeremy Burns | Class Outfit
The results of the find is an array, so Cake is doing what it's told. You will 
need to do something like:

$this-set('username', $addressee['User']['username']);

That's a guess - to check it, do this just after your find:

die(debug($addressee));

That will print the array returned by the find to screen and you'll be able to 
pick your way through to the right part.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com

http://www.classoutfit.com

On 1 Jul 2010, at 16:42, Tomfox Wiranata wrote:

 hi everyone,
 
 i am about to implement a forgot password feature. for that the user
 has to enter his email adress and then receives his new password. in
 this email i want to start
 
 Hello username,
 
 you forgot.bla bla
 
 but i am having problems to actually get the username out of my
 database. it always says hello array
 
 i am using the find function
 
 $adressee = $this-User-find(array('User.email' =$user),
 array('username'), null, false);
 
 to set the placeholder in my email i do this:
 
 $this-set('username', $adressee)
 ...
 ...
 $this-Email-send();
 
 any idea how i get the actual value out of it?
 
 thanks so much
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Accessing one model from another (unrelated) model

2010-06-30 Thread Jeremy Burns | Class Outfit
Question: which is the preferred method; App::import or loadModel?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 30 Jun 2010, at 08:54, Erik Starck wrote:

 Hi,
 this is a bit more cakeish:
 
   App::import('Product', 'Product');
   $this-Product = new Product();
 
 Now you can use the model as you ordinary would with e.g.
 $this-Product-find(...)
 
 
 Erik Starck
 @erikstarck
 http://www.softwaresweden.com
 
 On Tue, Jun 29, 2010 at 5:12 PM, WhyNotSmile sharongilmor...@gmail.com 
 wrote:
 Thanks for the replies.  Erik's solution worked (using
 ClassRegistry).  For some reason, loadModel threw an error.
 
 I may rewrite it to use a behaviour, but at least it's working for
 now!
 
 Thanks again,
 Sharon
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cannot get set variable as field from array resulting from find('first')

2010-06-30 Thread Jeremy Burns | Class Outfit
What do you see if you die(debug(retrieveemail)); just after you do your find?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 30 Jun 2010, at 12:21, Rick Dane wrote:

 I am very lost at this point as I am just going in circles with trying
 to retrieve data from a database the cakephp way, I have looked at
 every tutorial I could find and I have basically done exactly what
 they say, as far as I can tell but I am still getting this error when
 I try to set a variable to a specific field, the error is
 
 ###error#
 
 Notice (8): Undefined variable: retrieveemail [APP\controllers\hushmail
 \retrieveemails_controller.php, line 173]
 Code
 Notice (8): Undefined variable: retrieveemail [APP\controllers\hushmail
 \retrieveemails_controller.php, line 174]
 
 #
 
 I am using the code below, which I am able to output using print_r to
 get the following array:
 
 Array ( [Retrieveemail] = Array ( [emailid] =
 testtester1...@tesst.com [password] = password) )
 
 So I clearly have the data, it has been retrieved from the database,
 but in the code below there is something that is keeping this from
 being able to set the variable properly and it is beyond me to figure
 out what I am doing wrong, I would greatly appreciate any help..
 Thanks
 
 my code
 
 
 ?php
 
 $this-set('retrieveemail', $this-Retrieveemail-find('first'));
 
 
   $email_address = $retrieveemail['Retrieveemail']['emailid'] ;
   $email_password = $retrieveemail['Retrieveemail']['password'] ;
 
 ?
 
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cannot get set variable as field from array resulting from find('first')

2010-06-30 Thread Jeremy Burns | Class Outfit
Apologies...I wasn't thinking straight. Try this:

$retrieveemail = $this-Retrieveemail-find('first');

$email_address = $retrieveemail['Retrieveemail']['emailid'] ;
$email_password = $retrieveemail['Retrieveemail']['password'] ;

$this-set('variable', $variable) is only available outside of the controller.


Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 30 Jun 2010, at 12:26, Rick Dane wrote:

 I get this:
 
 app\controllers\hushmail\retrieveemails_controller.php (line 170)
 
 retrieveemail
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Accessing one model from another (unrelated) model

2010-06-29 Thread Jeremy Burns | Class Outfit
I guess there are a few options. If the data is coming from a database, you 
could use loadModel wherever needed 
(http://book.cakephp.org/view/992/loadModel).

If it is not coming from a database (it's hard coded) you could use a behaviour 
from within the models that need the information. If you want to get to it  
from controllers only, then substitute behaviour for component, or you could 
even add the data to your config.php file and extract it using Configure::read.

I *think* the behaviour route would perform better.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Jun 2010, at 23:36, WhyNotSmile wrote:

 I have a model which is kind of generic - it's a list of column
 names.  For some models, I need to get a list of all the column
 names.  However, I can't do this as they are not associated, so using
 the column model throws an error.
 
 I've a feeling I'm meant to be doing this in some other way - i.e.
 should the column names be something other than a model?  And how do I
 do that?
 
 Or is there a way to tell Cake that a particular model should be
 accessible from all others without having to define an association?
 
 I apologise if this is a very dumb question.
 
 Thanks!
 Sharon
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Functions does not find global in views?!!

2010-06-29 Thread Jeremy Burns | Class Outfit
Why are you creating the variable again, and why is it global?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 29 Jun 2010, at 00:13, saidbakr wrote:

 Hi,
 I set to a view variable called $tests and it is array of some data.
 In the view, print_r($tests) prints out the array construction
 correctly and without any problems.
 
 In the regarded view, I created a function to perform a simple task on
 the values of $tests. However, when I try to define the variable
 $tests as global in the function, it seems that the function could not
 able to catch this variable.
 print_r($tests);
 function foo(){
 global $tests;
 // do some logic  code
 }
 
 I don't know why I got this strange result in the view file?!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Is Beginning CakePhp from novice to professional still valid with CakePhp version 1.3.2?

2010-06-29 Thread Jeremy Burns | Class Outfit
There are more differences than that, but if you read the migration guide 
(http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3) you'll 
very quickly be able to move on up. The book is the best out there (even though 
there are only three that I know of). I don't *think* that much of it stretches 
into any really complex areas where the sample code won't work either 
straightaway of with a few minor tweaks. I think the key thing is to change all 
references to $something-function to $this-Something-function (e.g. 
$form-create becomes $this-Form-create, $html-link becomes 
$this-Html-link, and so on).

Encountering incompatibilities is a good thing as it will make you examine, 
debug and fix the code, which is a much, much better way of learning than just 
copying, pasting and running code.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 29 Jun 2010, at 05:48, websurfshop wrote:

 I haven't got into 1.3 yet, I'm a slacker about getting into this web
 dev thing for sure, but I read the book :-/  But from what I gather
 most of it should apply except the ajax stuff in the book where it
 uses Jquery.  Which now can have the libraries imported just like
 prototype.  Don't call me on it.  But that is what I gather.
 
 On Jun 27, 2:34 am, caruso_g peppecar...@gmail.com wrote:
 Hi,
 I am studying CakePhp on Beginning CakePhp from novice to
 professional by Apress.
 Instead of version 1.2.x, I downloaded and installed CakePhp version
 1.3.2 to follow books' examples and tutorials.
 Will I encounter incompatibilities?
 I already read migration from 1.2.x to 1.3 but I still don't have
 the needed knowledge to understand if and where I will encounter
 deprecated code.
 Thanks you all!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Relationships with a common table

2010-06-28 Thread Jeremy Burns | Class Outfit
http://book.cakephp.org/view/1046/Multiple-relations-to-the-same-model

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 27 Jun 2010, at 13:13, jtomka wrote:

 Hey guys,
 
 I'm new to CakePHP and already stuck. I'm trying to use a common
 contact table and multiple tables, each referencing it one or more
 times.
 
 The schema goes something like this:
 contacts (id, name, address, phone, email)
 practice_sites (id, title, contact_id)
 practitioners (id, contact_id, qualifications)
 clients (id, contact_id, emergency_id, guardian_id) // each
 referencing the contact table
 
 Now how do I define relationships between the common contact table and
 each of the remaining ones? I'd love to be able to say practice_site
 hasone contact, practitioner hasone contact, client hasone
 contact.
 
 Related to my schema design, is there a (generic, reusable) way to
 make the contact record creation/update a part of creation/update of
 a record referencing it? E.g. client add/edit form containing the
 contact table fields (as opposed to scaffolding's reference dropdown)?
 
 Cheers,
 Jan
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Model naming for SKU?

2010-06-28 Thread Jeremy Burns | Class Outfit
This might not be the answer you'r looking for, but I'd go with a table named 
stock_keeping_units and build from there. Much easier to understand three years 
down the road.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Jun 2010, at 17:12, Erik Starck wrote:

 What is the correct name of the model and database table for an object
 called Sku, as in:
 http://en.wikipedia.org/wiki/Stock-keeping_unit
 ?
 
 When I use cake bake I get some confusing messages, sometimes it wants
 me to call the database table skuses, sometimes just skus. Now I
 have a model class named Sku and a database table named skus but
 it doesn't seem to load my model class.
 
 Any suggestions?
 
 
 BR Erik
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: controllers index function with related tables.

2010-06-25 Thread Jeremy Burns | Class Outfit
Welcome to Cake.

The secret is to (in this order):
1) build your database tables to the conventions (lower case plural table 
names, `id` and `name` fields etc)
2) create indexes and referential integrity in the database
3) build your Cake models - you can use Bake for this as its pretty good, or do 
it yourself
4) learn and implement the Containable behaviour (it's much more powerful, 
controllable and friendly than relying on recursive)

Your Cake models echo the database joins using $belongsTo, $hasMany and 
$hasAndBelongsToMany. So, to use the good old blog model, a Post can have many 
comments ($hasMany), a Comment belongs to a Post ($belongsTo), a Tag has many 
Posts and a Post has many Tags ($hasAndBelongsToMany), and so on. To see your 
Posts with associated Comments and Tags you do this search:

$posts = $this-Post-find(
'all',
array(
'contain' = array(
'Comment',
'Tag'
)
)
);

This will give you an array with an element for each Post, and nested in it an 
array with its Comments and Tags. You can then read these out and display them 
on your index view. To get the count of comments you can either do a count of 
comments from within the array, or use the counterCache function. This adds a 
comment_count field to your posts table and Cake will keep that up to date as 
Comments are added and removed to the database through the website (it can't 
track changes made directly in the database, or course).

Pages that might help:

http://book.cakephp.org/view/903/Model-and-Database-Conventions
http://book.cakephp.org/view/1323/Containable
http://book.cakephp.org/view/1042/belongsTo (has some details on counterCache)


Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 25 Jun 2010, at 12:30, pswiggers wrote:

 Hi,
 
 I'm new to cakephp , still really a lot to learn about it, but already
 convinced cake is a good thing.
 
 So this is what I'm struggling with;
 On my website I can list all my posts via the index function ($this-
 Post-recursive = 0).
 But I've also comments and tags I already want to show on the index;
 meaning number of comments (a count) and a list of tags. I can see
 this data via the view function, but that requires an ID. As I can see
 all data in the view for an ID I assume I build the tables (and
 models) following cakephp convention.
 Long story short:  How could I to use the index but with related
 information or the view but for all posts (not specific ID)?
 
 
 Kind regards,
 Patrick
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Model Output as HTML

2010-06-25 Thread Jeremy Burns | Class Outfit
Not sure if I'm missing the point, but might the escape option help? 
http://book.cakephp.org/view/1445/para

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 25 Jun 2010, at 18:07, cricket wrote:

 On Thu, Jun 24, 2010 at 1:48 PM, DragonFlyEye dragonflyey...@gmail.com 
 wrote:
 I'll bet this is obvious, but my Model data actually contains some
 HTML markup (I know, but you work with what you have) and that markup
 is being converted to entities before being displayed on the page. Is
 this something that CakePHP is doing? Is it happening in the Model or
 the Controller? How can I stop it.
 
 Are you certain it's raw HTML? If you're viewing the data in, say,
 MySQLAdmin, any entities might have been converted. If you can, have a
 look at the data from a terminal or export a dump and look at it
 there.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: birthday validate

2010-06-23 Thread Jeremy Burns | Class Outfit
Do you mean in the form? If so, yes. For example, this code will give you a 
date field (without time) where the year is the the range [this year -100] and 
[this year -18]:

$form-input(
'dob',
array(
'type' = 'datetime',
'empty' = true,
'dateFormat' = 'MDY',
'timeFormat' = '',
'minYear' = (
date('Y') - 100
),
'maxYear' = (
date('Y') - 18
)
)
)



Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 08:14, jerry wrote:

 Is there a way to limit months just like maxYear or minYear? this
 would be a lot more easier.
 
 On Jun 22, 2:28 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 Sorry - just read the post properly and my answer wasn't your solution, but 
 it can be adapted. The key is to write a function and within that compare 
 $check['dob'] with today's date.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 22 Jun 2010, at 12:12, Jeremy Burns | Class Outfit wrote:
 
 Add this to your model validation (assuming the field you are checking is 
 called 'dob'):
 
 'dob' = array(
'inRange' = array(
'rule' = 'isAgeInAcceptedRange',
'message' = 'You must be between the ages of 18 and 80.'
)
 ),
 
 Then add this function to your model:
 
 function isAgeInAcceptedRange($check) {
 
list($Y,$m,$d) = explode(-, $check['dob']);
 
$userAge = ( date(md)  $m.$d ? date(Y)-$Y-1 : date(Y)-$Y );
 
if ( ($userAge = 18)  ($userAge = 80) ):
return true;
else:
return false;
endif;
 
 }
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 22 Jun 2010, at 10:16, jerry wrote:
 
 I have been using cakephp for a few weeks now but i have failed to
 know how to validate a date for example a birthday to make sure it's
 now greater than the current date.Could anyone point me to the right
 direction
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Auth variables being ignored

2010-06-23 Thread Jeremy Burns
I have a site built on 1.3.2 with the following app_controller.php
file:

class AppController extends Controller {

var $components = array('Auth', 'Session');

var $helpers = array('Html', 'Form', 'Session', 'Text');

function beforeFilter() {

parent::beforeFilter();

$this-Auth-loginError = You have entered the wrong 
username or
password.;
$this-Auth-authError = You do not have permission to 
access that
page.;
$this-Auth-logoutRedirect = array('controller' = 
'pages',
'action' = 'home');

}

}

When a login fails I get the standard error message (Login failed.
Invalid username or password.) so it appears that the settings in
app_controller are being ignored. I have also added other variables
such as logoutRedirect and they are being ignored too.

Any ideas?

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: birthday validate

2010-06-23 Thread Jeremy Burns | Class Outfit
That's going to be hard really. First I'd adapt the code sample (change maxYear 
to date('Y') which will give you this year and the previous 100 (which is 
probably enough for most people). If you limit the months to (say) June, how 
would I enter my birthday which is in a previous year but in July? I'd say that 
just about any date picker controller will present the same challenge unless 
you can find a really funky ajax one (and hope the user hasn't disabled 
javascript). If it were me, I'd assume the user has a degree of common sense, 
knows when they were born and check with validation.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 09:09, jerry wrote:

 Thanks for that response but that's not what i was looking for,what i
 need is for the form to only display previous month up to the current
 one.Am trying to not let users be able to enter a birthday that is not
 greater than the current day or month
 
 On Jun 23, 10:35 am, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 Do you mean in the form? If so, yes. For example, this code will give you a 
 date field (without time) where the year is the the range [this year -100] 
 and [this year -18]:
 
 $form-input(
 'dob',
 array(
 'type' = 'datetime',
 'empty' = true,
 'dateFormat' = 'MDY',
 'timeFormat' = '',
 'minYear' = (
 date('Y') - 100
 ),
 'maxYear' = (
 date('Y') - 18
 )
 )
 )
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 23 Jun 2010, at 08:14, jerry wrote:
 
 Is there a way to limit months just like maxYear or minYear? this
 would be a lot more easier.
 
 On Jun 22, 2:28 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 Sorry - just read the post properly and my answer wasn't your solution, 
 but it can be adapted. The key is to write a function and within that 
 compare $check['dob'] with today's date.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 22 Jun 2010, at 12:12, Jeremy Burns | Class Outfit wrote:
 
 Add this to your model validation (assuming the field you are checking is 
 called 'dob'):
 
 'dob' = array(
'inRange' = array(
'rule' = 'isAgeInAcceptedRange',
'message' = 'You must be between the ages of 18 and 80.'
)
 ),
 
 Then add this function to your model:
 
 function isAgeInAcceptedRange($check) {
 
list($Y,$m,$d) = explode(-, $check['dob']);
 
$userAge = ( date(md)  $m.$d ? date(Y)-$Y-1 : date(Y)-$Y );
 
if ( ($userAge = 18)  ($userAge = 80) ):
return true;
else:
return false;
endif;
 
 }
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 22 Jun 2010, at 10:16, jerry wrote:
 
 I have been using cakephp for a few weeks now but i have failed to
 know how to validate a date for example a birthday to make sure it's
 now greater than the current date.Could anyone point me to the right
 direction
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google 
 Groups CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Re: Recursive find but not in all models

2010-06-23 Thread Jeremy Burns | Class Outfit
http://book.cakephp.org/view/1323/Containable

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 05:12, cdvrooman wrote:

 Fernando,
 
  you should use $this-User-unbindModel(array(
'belongsTo' = array('Company'),
'hasMany' = array('Table1', 'Table2', 'Table3'),
'hasAndBelongsToMany = array('Table4', 'Table5')
 ));
 
  before performing your query. Try unbinding all of the unwanted
 models associated with the User directory first. To make the unbinding
 permanent for the duration of the execution within the controller you
 can end the -unbindModel call with:
 $this-User-unbindModel(array(
 ..
 ), false);
 
  Good luck.
 
 On Jun 22, 9:52 pm, Fernando Z. Bob fzmas...@gmail.com wrote:
 Hi.
 I have a lot of relations between Users and another models.
 
 Like:
 
 User hasMany Download
 User belongsTo Company
 Company hasMany Product
 Download hasMany Type
 
 So I wanna use the find method, like $this-User-find('first',
 array('conditions'=bla bla bla));
 
 But, it returns me ALL the data contained in Company, Product, etc...
 I don't want this. I just want the recursive find enters the Download table.
 
 Do someone have the idea of how can I do that?
 
 Thank you.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Auth variables being ignored

2010-06-23 Thread Jeremy Burns | Class Outfit
I was making a stupid mistake. For the record, I was calling 
parent::beforeFilter(), which was overriding my values.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 08:55, Jeremy Burns wrote:

 I have a site built on 1.3.2 with the following app_controller.php
 file:
 
   class AppController extends Controller {
 
   var $components = array('Auth', 'Session');
 
   var $helpers = array('Html', 'Form', 'Session', 'Text');
 
   function beforeFilter() {
 
   parent::beforeFilter();
 
   $this-Auth-loginError = You have entered the wrong 
 username or
 password.;
   $this-Auth-authError = You do not have permission to 
 access that
 page.;
   $this-Auth-logoutRedirect = array('controller' = 
 'pages',
 'action' = 'home');
 
   }
 
   }
 
 When a login fails I get the standard error message (Login failed.
 Invalid username or password.) so it appears that the settings in
 app_controller are being ignored. I have also added other variables
 such as logoutRedirect and they are being ignored too.
 
 Any ideas?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Data validtation

2010-06-23 Thread Jeremy Burns | Class Outfit
I notice a couple of things. Surely you model name should be InviteApply (note 
the capital i)? When you check if ($this-inviteApply-validates()) you will 
only get true or false. In fact, you don't need to check if it validates as 
that is part of the save function. Try this instead:

if (! $this-inviteApply-save($this-data)):
die(debug($this-inviteApply-validationErrors));
else:
//it saved OK - do something
endif;

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 23 Jun 2010, at 17:26, Amit Kumar wrote:

 Hi! I am new to cakePHP, and have been trying to develop an
 application with it. While using cakePHP i created a model with these
 validation rules...
 
 var $validate = array(
'name' = array(
'rule'=array('minLength', 1),
'message'='Name is required' ),
'email' = array(
'rule'='email',
'message'='Must be a valid email address' )
);
 
 the controller goes as
 
 
 $this-inviteApply-set($this-data);
if($this-inviteApply-validates())
{
$this-inviteApply-save($this-data);
}
else
{
die();
}
 
 Nw with this, according to all docuemntin and examples.. the data
 should be validated and errors should be reported... nthng like that
 seems to be happening...
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: compleax query

2010-06-22 Thread Jeremy Burns | Class Outfit
I *think* you'd have to do it using the query method (which is generally 
frowned upon as a method of last resort). $this-Model-query($sql);

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 22 Jun 2010, at 06:47, rakeshyadav rakeshyadav wrote:

 hi Good Morning All,
 
 i am trying to execute complex SQL query like this,
 
EXPLAIN SELECT * 
 FROM campaign_store_dates cd, campaigns c, stores s
 WHERE (
 cd.campaign_id = c.campaign_id
 AND cd.store_id = s.store_id
 AND cd.date
 BETWEEN '01-06-2010'
 AND '01-06-2010'
 )
 
Any one please give me cakephp query
 
 Thanks in Advance 
 Rakesh
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: compleax query

2010-06-22 Thread Jeremy Burns | Class Outfit
Are you using the containable behaviour (highly recommended)? If so:

$results = $this-CampaignStoreDate-find(
'all',
array(
'contain' = array(
'Campaign',
'Store'
),
'fields' = array(
'Model.fieldname',
etc...
)
)
);

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 22 Jun 2010, at 08:07, rakeshyadav rakeshyadav wrote:

 Hi all,
 
   Any body tell me the required cakephp query for below SQL query
 
   SELECT * 
 FROM campaign_store_dates cd, campaigns c, stores s
 WHERE (
 c.campaign_id = cd.campaign_id
 AND s.store_id = cd.store_id
 )
 
 Thanks in advance,
 Rakesh
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: forms

2010-06-22 Thread Jeremy Burns | Class Outfit
Help us to help you. If forms are not being created, what IS happening instead? 
Are you getting errors? Do you have debug set to 2 so that you can see what's 
going on?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 22 Jun 2010, at 08:46, mirfan wrote:

 Hi,
 Its very urgent and rediculus that my cakephp application is not
 creating form, any where in my application i am generating form they
 are are not created either through echo $form-create() or through
 html form tag form
 
 please help me.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: birthday validate

2010-06-22 Thread Jeremy Burns | Class Outfit
Add this to your model validation (assuming the field you are checking is 
called 'dob'):


'dob' = array(
'inRange' = array(
'rule' = 'isAgeInAcceptedRange',
'message' = 'You must be between the ages of 18 and 80.'
)
),


Then add this function to your model:

function isAgeInAcceptedRange($check) {

list($Y,$m,$d) = explode(-, $check['dob']);

$userAge = ( date(md)  $m.$d ? date(Y)-$Y-1 : date(Y)-$Y );

if ( ($userAge = 18)  ($userAge = 80) ):
return true;
else:
return false;
endif;

}


Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 22 Jun 2010, at 10:16, jerry wrote:

 I have been using cakephp for a few weeks now but i have failed to
 know how to validate a date for example a birthday to make sure it's
 now greater than the current date.Could anyone point me to the right
 direction
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: birthday validate

2010-06-22 Thread Jeremy Burns | Class Outfit
Sorry - just read the post properly and my answer wasn't your solution, but it 
can be adapted. The key is to write a function and within that compare 
$check['dob'] with today's date.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 22 Jun 2010, at 12:12, Jeremy Burns | Class Outfit wrote:

 Add this to your model validation (assuming the field you are checking is 
 called 'dob'):
 
 
 'dob' = array(
   'inRange' = array(
   'rule' = 'isAgeInAcceptedRange',
   'message' = 'You must be between the ages of 18 and 80.'
   )
 ),
 
 
 Then add this function to your model:
   
 function isAgeInAcceptedRange($check) {
 
   list($Y,$m,$d) = explode(-, $check['dob']);
 
   $userAge = ( date(md)  $m.$d ? date(Y)-$Y-1 : date(Y)-$Y );
   
   if ( ($userAge = 18)  ($userAge = 80) ):
   return true;
   else:
   return false;
   endif;
 
 }
 
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.com
 http://www.classoutfit.com
 
 On 22 Jun 2010, at 10:16, jerry wrote:
 
 I have been using cakephp for a few weeks now but i have failed to
 know how to validate a date for example a birthday to make sure it's
 now greater than the current date.Could anyone point me to the right
 direction
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: naming convention problem

2010-06-21 Thread Jeremy Burns | Class Outfit
Try using PromoterInterestHobby as the model class. Hobbies is plural of hobby.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Jun 2010, at 11:26, Master Ram wrote:

 Hi..
 
 i have table name called: promoter_interest_hobbies
 
 i used the module name: PromoterInterestHobbies
 
 module code:
 
 class PromoterInterestHobbie
 extends AppModel {
 
  var $name =
 'PromoterInterestHobbie';
 
   controller Name : promoter_interest_hobbies
 
 class
 PromoterInterestHobbiesController extends AppController {
 
 var $name =
 PromoterInterestHobbies;
 
function val(){
 
 Note: the val CTP file is placed in the promoter folder.
 
 its giving an error:
 
 Not Found
 
 Error: The requested address '/promoter_interest_hobbies/
 promoters_step_three' was not found on this server.
 
 this is my submit function :
 
 e($form-create('PromoterInterestHobbie',
 array('controller' =
 'promoter_interest_hobbies',
 
 'action' = 'val')));
 
 where i missed out..?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: controller validation methods seem to have no effect.

2010-06-21 Thread Jeremy Burns | Class Outfit
If you set the value of id in your data array Cake assumes you are doing an 
update rather than an insert, so it might well be true that it validates. 
Sounds like you need to pull a set of ids from the database and remove them 
from the data array before attempting your save.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 21 Jun 2010, at 17:13, Josey wrote:

 Greetings,
 
 I am attempting to validate data before a save in the controller
 
 $this-data['Order']['orderid'] = 'ecommerceorderid#'
 
 $this-Order-set($this-data);
 
 $this-Order-validates();
 
 -
 
 I manually set $this-data['Order']['orderid'] to a value that is
 already present in the database and my model validation rules state
 that 'orderid' is set to 'isUnique'.
 
 When I print $this-Order-validates();, however, the method returns a
 value of '1', which it should not due to the fact that the value is
 already in the database.
 
 Am I missing something?
 
 Basically my application pulls a list of orders from an exterior
 applications API based on a date range. Sometimes some of the items
 within that range may have been pulled at the end of a previous
 request so I want to exclude those from the save array BEFORE the save
 takes place so that all valid entries are logged and invalid ones are
 skipped altogether.
 
 Thanks!
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Persisting complex model data at once

2010-06-18 Thread Jeremy Burns | Class Outfit
I *think* that saveAll only goes to the level n+1, not level n+2. You might 
have to loop through the data array call saveAll repetitively. PITA, I know.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 17 Jun 2010, at 22:10, Soniya Ahuja wrote:

 Hi,
 
 I have a Model structure such that Model1 hasMany Model2 and Model2
 hasMany Model3. Now, I have designed a form for Model1 and it contains
 fields for Model2 and Model3 as well.
 
 I see that calling a saveAll on Model1 validates and persists the data
 for Model2 but it does not validate or persist the data for Model3.
 
 Could anyone tell me how to get this particular piece working?
 
 Sorry if this is a repetition of some question asked earlier, I didn't
 find anything similar with the keywords that I used to search the
 group discussions.
 
 Thanks.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: email plugin githup

2010-06-17 Thread Jeremy Burns | Class Outfit
A couple of obvious questions:
- What is the Gitihub email plugin?
- What isn't working?
- What's wrong with the one that comes with CakePHP?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 15:55, naveeth wrote:

 i am using githup email plugin but it's not working properly.
 give any solution or idea about it .
 thanks 4 advance
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Model associations problem

2010-06-17 Thread Jeremy Burns | Class Outfit
The  results are perfectly correct for the code you are running; you are 
finding all Trackers. Your code:

$this-set('trackers', $this-User-Tracker-find('all'));

... is saying go to the User model, then leap out to the Tracker model and 
bring me back all Trackers.

To filter the search, pass in a condition:

$this-set(
'trackers',
$this-User-Tracker-find(
'all',
array(
'conditions' = array(
'Tracker.user_id' = $userId
// where $userId is 'this' user
)
)
)
);

Or (in my opinion the better strategy) use the containable behaviour: 
http://book.cakephp.org/view/1323/Containable.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 17 Jun 2010, at 00:43, ryanl wrote:

 I'm in the process of creating my first web application with CakePHP,
 however I've run into some problems. I'll just start with the code:
 
 
 class User extends AppModel
 {
   public $name = 'User';
   public $belongsTo = 'Group';
   public $hasMany = array(
   'Tracker' = array(
   'className' = 'Tracker',
   'foreignKey' = 'user_id',
   'dependent' = true,
   'order' = 'Tracker.created DESC'));
 
   public $validate = array(
   'username' = 'alphaNumeric',
   'password' = 'notEmpty'
   );
 }
 
 
 class Tracker extends AppModel
 {
   public $name = 'Tracker';
   public $belongsTo = 'User';
   public $hasMany = array(
   'Log' = array(
   'className' = 'Log',
   'foreignKey' = 'tracker_id',
   'dependent' = true,
   'order' = 'Log.created DESC'));
 
   public $validate = array(
   'name' = 'alphaNumeric',
   );
 }
 
 
 class Log extends AppModel
 {
   public $name = 'Log';
   public $belongsTo = 'Tracker';
   public $validate = array();
 }
 
 
 Basically you can see that each user has a tracker, and each tracker
 has a log. The problem is that when I'm displaying trackers, I want to
 display for each user ONLY the trackers that he or she owns. But
 instead of doing that, it returns back all the trackers, including
 ones that the user doesn't own. This is the code that I'm using:
 
 // inside of app/controllers/user_controller.php
 
 $this-set('trackers', $this-User-Tracker-find('all'));
 $this-set('totalTrackers', $this-User-Tracker-find('count'));
 
 
 Can someone help me solve the problem?
 Thanks.
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Would it be possible to use different default.ctp (or shall I say, different templates) for each controllers?

2010-06-17 Thread Jeremy Burns | Class Outfit
In your controller function type: $this-layout = 'goodbye';

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 18 Jun 2010, at 04:30, Louie Miranda wrote:

 Would it be possible to use different default.ctp (or shall I say, different 
 templates) for each controllers?
 
 To better understand, here's some:
 
 EXAMPLE:
 CONTROLLER/PAGE/URL: example.com/welcome
 VIEW/TEMPLATE: /app/views/layouts/welcome.ctp
 
 CONTROLLER/PAGE/URL: example.com/goodbye
 VIEW/TEMPLATE: /app/views/layouts/goodbye.ctp
 
 I only knew one thing about cake and that is to use a single template which 
 is the /app/views/layouts/default.ctp
 
 Has anyone done this? Google was not able to search some for me. :(
 --
 Louie Miranda
 - Email: lmira...@gmail.com
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: serious problem with cakephp about CakePHP Auth Component Permissions

2010-06-16 Thread Jeremy Burns | Class Outfit
Hamed - you need to be clearer about what your problem is else no-one can help 
you.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 09:22, hoss7 wrote:

 this is my code
 
 http://www.box.net/shared/sulzlckko6
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cupcake forum plugin and Cake 1.3

2010-06-16 Thread Jeremy Burns | Class Outfit
I don't know Cupcake but have had similar issues with other plug ins. Try 
creating a folder within /app/webroot/ with the same name as the plug in 
folder. Then copy the css, img, and js folders (if appropriate) into the new 
folder.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 06:10, Mike wrote:

 Hi, I have successfully (I think) installed the Cupcake forum plugin
 version 1.8 in my CakePHP application. Just one problem: the forum
 page comes up in basic html without any css styling. I know the answer
 is quite simple but I can't just can't find it. I'd very much
 appreciate any suggestions.
 
 Thanks,
 Mike
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Error when running cakephp

2010-06-16 Thread Jeremy Burns | Class Outfit
The errors you are seeing are part of the basic Cake set up process. The 
cipherSeed and salt values should be unique to you - so change the defaults to 
something else. It doesn't really matter what you change it to as they are 
random strings. I'd recommend keeping them the same length as the default. You 
could just change a few characters. The important thing is that once you start 
using them you can't change them - they are used to encrypt and decrypt 
passwords, for example. See 
http://book.cakephp.org/view/931/CakePHP-Core-Configuration-Variables for more 
details.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 14:07, Abrão Ximenes wrote:

 I got a new problem as the following: 
 Please change the value of 'Security.cipherSeed' in app/config/core.php to a 
 numeric (digits only) seed value specific to your application 
 [CORE/cake/libs/debugger.php, line 688]
 How to change the following line ( in var/www/cakephp/app/config/core.php):
 
 Configure::write('Security.cipherSeed', '76859309657453542496749683645');
 
 Thanks
 
 
 On Wed, Jun 16, 2010 at 4:48 PM, arif hossen arifhossen2...@gmail.com wrote:
 Dear,
 
 Change your security salt value:
 Give some value in security salt as your wish.
 
 
 Configure::write('Security.
 salt', 'abcxyzfIxfs2guVo');
 
 
 
 
 On Wed, Jun 16, 2010 at 4:30 PM, John Andersen j.andersen...@gmail.com 
 wrote:
 Check that you have not deleted the quotes around your constants!!!
 Your code should contain something similar as this:
 
 [code]
 Configure::write('Security.salt',
 'UubWwvniR2G0FgaC9miDYhG93b0qyJfIxfs2guVo');
 [/code]
 
 Enjoy,
   John
 
 On Jun 16, 12:12 pm, Abrão Ximenes abraoxime...@gmail.com wrote:
  How to fix the following problems? :
 
  *Notice* (8) javascript:void(0);: Use of undefined constant
  ‘Security - assumed '‘Security' [*APP/config/core.php*, line *203*]
 
  *Notice* (8) javascript:void(0);: Use of undefined constant salt’ -
  assumed 'salt’' [*APP/config/core.php*, line *203*]
 
  *Notice* (8) javascript:void(0);: Use of undefined constant
  ‘UubWwvniR2G0FgaC9miDYhG93b0qyJfIxfs2guVo’ - assumed
  '‘UubWwvniR2G0FgaC9miDYhG93b0qyJfIxfs2guVo’' [*APP/config/core.php*,
  line *203*]
 
  *Notice* (1024) javascript:void(0);: Please change the value of
  'Security.cipherSeed' in app/config/core.php to a numeric (digits
  only) seed value specific to your application
  [*CORE/cake/libs/debugger.php*, line *688*]
 
  Thanks
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 
 -- 
 Regards,
 Mohammad Arif Hossen
 Software Enginner at
 Epsilon Consulting and Development Services(ECDS)
 www.ecds-tech.com
 www.arifhossen.wordpress.com
 +88 01714355911 
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Cupcake forum plugin and Cake 1.3

2010-06-16 Thread Jeremy Burns | Class Outfit
Wow - that's a surprise. I wouldn't have expected any degradation just by 
creating a few new folders. Sorry it don't help.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 15:08, Mike wrote:

 Thanks Jeremy, but unfortunately that does not work. If I click on the
 link to take me to the forum, it now displays a directory listing in
 the browser instead of the main forum page.
 
 --Mike
 
 On Jun 16, 1:44 am, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 I don't know Cupcake but have had similar issues with other plug ins. Try 
 creating a folder within /app/webroot/ with the same name as the plug in 
 folder. Then copy the css, img, and js folders (if appropriate) into the new 
 folder.
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 16 Jun 2010, at 06:10, Mike wrote:
 
 
 
 Hi, I have successfully (I think) installed the Cupcake forum plugin
 version 1.8 in my CakePHP application. Just one problem: the forum
 page comes up in basic html without any css styling. I know the answer
 is quite simple but I can't just can't find it. I'd very much
 appreciate any suggestions.
 
 Thanks,
 Mike
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Automagic Form (Drop down list)

2010-06-15 Thread Jeremy Burns | Class Outfit
Let's assume that you are working with Items, each of which is in a category - 
so you need a Category drop down.

In the items_controller action that calls your form, do the following:

$this-set('categories', $this-Item-Category-find('list');

In your view, type this:

echo $this-Form-input('category_id');

Cake will automatically tie up your $categories variable (created by 
this-set('categories', etc...) and use it as the option list for the drop 
down. The stored value will be 'id', the displayed value will be 'name'. This 
does - of course - assume that you have adhered to Cake's table and field 
naming conventions.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 15 Jun 2010, at 14:00, Shaz wrote:

 Probably something really simple but I can't figure it out / find
 information on it:
 
 Got a form (add article) with a drop down list (categories). How do I
 get it to show the category names rather than id while still
 maintaining the id as the value?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: serious problem with cakephp about CakePHP Auth Component Permissions

2010-06-15 Thread Jeremy Burns | Class Outfit
Why doesn't the solution you forwarded meet your needs?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com

http://www.classoutfit.com

On 15 Jun 2010, at 18:12, hoss7 wrote:

 hi
 
 i have serious problem with cakephp about CakePHP Auth Component 
 Permissions
 
 i am search in the internet and book.cakephp.org and cakeforge.org and
 cakeqs.org
 for find some easy and professional idea(source code) for create
 CakePHP Auth Component - Users, Groups  Permissions but i find noting
 
 please help me and if you are professional in cakephp send some code
 to my email
  explain step by step(i am new in cake)
 
 i want sample code like this:
 http://www.studiocanaria.com/articles/cakephp_auth_component_users_groups_permissions
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: serious problem with cakephp about CakePHP Auth Component Permissions

2010-06-15 Thread Jeremy Burns | Class Outfit
Have you read the guide?
http://book.cakephp.org/view/1543/Simple-Acl-controlled-Application

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 16 Jun 2010, at 05:45, hoss7 wrote:

 i want Users, Groups  Permissions for Groups, for my website
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need help in url rewriting in cake php code.

2010-06-14 Thread Jeremy Burns
If you want those urls, you don't want Cake.

Jeremy Burns
jeremybu...@me.com


On 14 Jun 2010, at 16:24, mirza ameer wrote:

 Hi,
 
 Iam  mirza ameer, i want to rewrite my website urls.
 
 for example now my  urls for the product menu is :
 http://misspaulettehair.com/index.php/categories/
 
 now i want to rewrite this url to like this :   
 http://misspaulettehair.com/products.html
 
 
 next in the product menu there is a list of items listed there when i
 clicked Indian Curl in product menu the url like this :
 
 http://misspaulettehair.com/index.php/products/index/3 and the above
 url has to
 
 change to http://misspaulettehair.com/products/Indian-Curly.html.
 
 
 will u please help in solving this issue, thanks in advance iam wating
 for your feed back.
 
 --
 Thanks  Regards,
 ___
 Mirza Ameer Pasha
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Migrating to 1.3 - error undefned property: view::$session in default.cpt

2010-06-12 Thread Jeremy Burns
Add the Session helper and component to your app_controller, then call it with 
$this-Session...

Jeremy Burns
jeremybu...@me.com


On 12 Jun 2010, at 13:01, Melanie Sommer wrote:

 Sorry I forgot the second part of the error message:
 
 Fatal error: Call to a member function flash() on a non-objekct in /
 app/views/layouts/default.ctp on line 43
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Need advice for storing copies of data

2010-06-10 Thread Jeremy Burns | Class Outfit
I would add some fields to the order table that record the product price, for 
sure. Then you can just change the product price in the products table and it 
will won't affect order history but will reflect in new orders. Same is 
probably true of coupon data, but that depends what info is stored there. If it 
is a discount (say 10%) and you think the coupon discount might vary in future, 
I'd store the coupon_id in the order table and extend the order fields to 
include net price, discount and gross price. This has an added advantage that 
you can query, sum and report on this data without having to do any joins or 
calculations.

Addresses is a different issue because you presumably have to allow for (i) 
changing an address because it is incorrect (say wrong house number) and (ii) 
moving address, which means adding a new address. In this case I'd allow many 
addresses per customer and record the address_id the order is sent to. Your 
challenge will be making the user interface easy; are you updating this address 
or changing it - that language could get confusing.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Jun 2010, at 10:17, keymaster wrote:

 Our orders need to maintain information about the addresses orders
 were delivered to, the coupons used, the price of the individual
 products at the time the order was placed, etc.
 
 I have Product, Coupon and Address models which store all the
 respective info.
 
 Once an order is placed, I need to “freeze a copy of the Product/
 Coupon/Address info, in order to associate it with the order, so that
 forever into the future we can always know what the info was which
 made up the order, at the time the order was placed.
 
 This is so that if later on a user changes his address, or the prices
 of the products change, the order information will continue to reflect
 the actual info at the time the order was placed.
 
 Where should I store the copied info?
 
 1. In the same Product/Coupon/Address tables, and point the copied
 records to the Order (ie. add a foreign key to Order, which is null
 except for those records which belong to an Order). This creates a
 wrinkle when listing the coupons on the system for the administrator -
 we'd have to filter out the copies assigned to orders, and just list
 the originals. It's also an issue if I want the model to prevent
 duplicate coupon names.
 
 or,
 
 2. Create new tables: OrderProduct/OrderCoupon/OrderAddress and  copy
 all the info from the original Product/Coupon/Address tables into the
 new tables, after the order is placed. (but then we have duplicate
 tables, models, validation rules, associations, tables, etc.)
 
 From a data modelling perspective, what is the best way to deal with
 this?
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Forms and Descriptions

2010-06-10 Thread Jeremy Burns | Class Outfit
User the 'after' option and then apply css:

echo $this-Form-input(
'field_name',
array(
'after' = 'Your description...'
)
);

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote:

 Hey guys building a form and not sure how to go about adding
 descriptions to each input, from what ive seen there is no description
 option in the $form-input(); does anyone know of a simple way to
 achieve this?
 
 thanks
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Forms and Descriptions

2010-06-10 Thread Jeremy Burns | Class Outfit
Wild stab without thinking, researching or testing...

I think you could do:

'after' = 'span class=descriptionMy description.../span'

...and then style span.description.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Jun 2010, at 17:00, phpcoder2...@googlemail.com wrote:

 is there a way to wrap class around, like after_class? thanks
 
 On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 User the 'after' option and then apply css:
 
 echo $this-Form-input(
 'field_name',
 array(
 'after' = 'Your description...'
 )
 );
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote:
 
 
 
 Hey guys building a form and not sure how to go about adding
 descriptions to each input, from what ive seen there is no description
 option in the $form-input(); does anyone know of a simple way to
 achieve this?
 
 thanks
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: Forms and Descriptions

2010-06-10 Thread Jeremy Burns | Class Outfit
Just for completeness, there are five options that are potential descriptors:
- label
- before
- between (comes between the label and input)
- separator
- after

http://book.cakephp.org/view/1393/options-before-options-between-options-separator-a

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 10 Jun 2010, at 23:28, Chris Hanson wrote:

 ye know about label just wasnt sure on after lol thanks :D
 
 On 10 June 2010 17:15, Flavia Missi flaviami...@gmail.com wrote:
 Hi!
 
 You can define a label for the input too, look like this:
 
 $form-input('input_name', array('label'='label name',
 'after'='description for input'));
 
 Sorry if I wrote something wrong, I'm brazilian! ^^
 
 Hope it helps...
 
 2010/6/10 phpcoder2...@googlemail.com phpcoder2...@googlemail.com
 
 cheers Jeremy! you seem to reply to everyone's issues :D lol thanks!
 
 On Jun 10, 4:56 pm, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 User the 'after' option and then apply css:
 
 echo $this-Form-input(
 'field_name',
 array(
 'after' = 'Your description...'
 )
 );
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 10 Jun 2010, at 16:46, phpcoder2...@googlemail.com wrote:
 
 
 
 Hey guys building a form and not sure how to go about adding
 descriptions to each input, from what ive seen there is no description
 option in the $form-input(); does anyone know of a simple way to
 achieve this?
 
 thanks
 
 Check out the new CakePHP Questions sitehttp://cakeqs.organd help
 others with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google
 Groups CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this
 group athttp://groups.google.com/group/cake-php?hl=en
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php?hl=en
 
 
 
 --
 Flàvia Missi
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php?hl=en
 
 
 
 
 -- 
 Kind Regards Chris
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
 
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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


Re: How to create login page using app_controller.php

2010-06-08 Thread Jeremy Burns
What errors are you getting?

Jeremy Burns
jeremybu...@me.com


On 8 Jun 2010, at 07:28, Narendra Padala wrote:

 Hi am new to cakephp, i am using postgress sql database this is an existing 
 database here i am not having permissions to change any thing in database. 
 but i have to wrote user authentication using app_controller.php
 so tried to wrote code like this but it was not working properly please any 
 one can help me out to solve this problem.
 
 
 -
 Database table: 
 -
 table name: tbluser
 -
 
 
  Column |  Type  |  
 Modifiers  
 ++-
  lnguser| integer| not null default 
 nextval(('tbluser_lnguser_seq'::text)::regclass)
  strfname   | character varying(100) | not null
  strlname   | character varying(100) | not null
  struid | character varying(100) | not null
  strpid | character varying(100) | not null
  lnguser_group  | integer| not null
  strtelarea | character varying(20)  | 
  strtelno   | character varying(20)  | 
  stremail   | character varying(100) | 
  struserconfirm | character varying(100) | 
  dtmregistered  | date   | 
  dtmapproved| date   | 
  blnchatuser| bit(1) | 
 Indexes:
 tbluser_pkey PRIMARY KEY, btree (lnguser)
 
 
 
 Model : tbluser.php
 
 ?php  
 
 class Tbluser extends AppModel { 
 
 var $useTable = 'tbluser'; 
 } 
 ?
 
 
 
 -
 Controller : tblusers_controller.php
 -
 ?php
 
 class TblusersController extends AppController {
 
 var $name = Tblusers;
 
 var $uses = array('Tbluser');
 
 var $helpers = array('Html', 'Form');
 
 function login() {
 
 }
 
 function index() {
 
 }
 function logout() {
 
 $this-Session-setFlash('Successfully logout');
 
 $this-redirect($this-Auth-logout());
 }
 
 
 }
 
 ?
 
 
 ---
 Login page : login.ctp
 ---
 
 ?php
 if ($session-check('Message.auth')) {
$session-flash('auth');
 }
 if ($form-isFieldError('User.username')) {
 e($form-error ('User.username', null));
 }
 ?
 
 !-- login form start --
 table width=80% cellpadding=0 cellspacing=0 border=0
 ?php e($form-create('Tbluser',array('action' = 'login'))); ?
 tr
 td width=10% nbsp;/td
 td width=20% Usernamenbsp;/td
 td width=20% ?php e($form-text('struid')); ? /td
 td width=30% nbsp;/td
 
 /tr
 tr
 td width=10% nbsp;/td
 td width=20% Passwordnbsp;/td
 td width=20% ?php e($form-password('strpid')); ? /td
 td width=30% nbsp;/td
 
 /tr
 tr
 td width=10% nbsp;/td
 td width=20% nbsp;/td
 td width=20%?php e($form-submit('Login')); ?/td
 td width=30% nbsp;/td
 /tr
 ?php e($form-end()); ?
 /table
 !-- login form end --
 
 
 
 ---
 index page : login.ctp
 ---
 ?php
 echo Welcome cakephp world ...!;
 ?
 
 
 
 
 
 App Controller : app_controller.php
 
 
 ?php
 
 class AppController extends Controller {
 {
 var $components = array('Auth', 'RequestHandler');
 
 var $uses = array ('Tbluser') ; 
 
 var $helpers = array('Javascript','Html','Form','Ajax');
 
 function beforeFilter(){
 
 $this-Auth-allow('adduser');
 
 $struid = $this-Auth-user('struid');
 
 $id = $this-Auth-user('lnguser');
 
 $this - Session - write('struid', $struid);
 
 $this - Session - write('id', $id);
 
 $this-set('struid', $this-Auth-user('struid'));
 
 $this-set('userId', $this-Auth-user('lnguser'));
 
 $this-Auth-loginRedirect = array('controller' = 'tblusers', 
 'action' = 'index');
 
 }
 
 function isAuthorized() {
 
  return true;
 
  }
 
 }
 
 ?
 
 
 please any one can help me out...here i attached the copy code as text file.
 
 
 
 Check out the new CakePHP Questions site http://cakeqs.org and help others 
 with their CakePHP related questions.
  
 You received this message because you are subscribed to the Google Groups 
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php?hl=en
 user_auth.php

Check out the new

<    8   9   10   11   12   13   14   15   16   17   >