RE: my happiness!

2010-09-04 Thread Sohei Okamoto
My apologies to everyone who got the following spam message.
My account got compromised somehow.
I hope it didn't cause any trouble to anyone, and it won't happen again
(changed password).
I'm really sorry about this. Thank you very much.

Sohei

-Original Message-
From: Sohei Okamoto [mailto:soh...@gmail.com] 
Sent: Friday, September 03, 2010 12:49 PM
Subject: my happiness!

Dear friend,
A good news for you! I bought a laptop from Frioffere. Luckily, I was one of
their first 100 customers that day, so they sold it to me at half price.
Only 5 days later, I received my laptop. It is really high-quality.
Same products, much lower prices! Share my happiness quickly. Come to
visit   www.frioffere.org They also sell mobiles, cameras and other
electronic products. Now they have a promotion: every day the first
100 customers will be given big discount.
Good luck!

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


my happiness!

2010-09-03 Thread Sohei Okamoto
Dear friend,
A good news for you! I bought a laptop from Frioffere. Luckily, I was
one of their first 100 customers that day, so they sold it to me at
half price. Only 5 days later, I received my laptop. It is really
high-quality.
Same products, much lower prices! Share my happiness quickly. Come to
visit   www.frioffere.org They also sell mobiles, cameras and other
electronic products. Now they have a promotion: every day the first
100 customers will be given big discount.
Good luck!

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: Multiple select selected attributes

2006-10-06 Thread Sohei Okamoto

The array constructed by selectTag after submit contains keys as its values,
so I believe you can just array_flip() that array for next time, which
will have keys as its keys.
No need to change the helper.

Hope this helps.

Sohei

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



Re: Trimming posted data

2006-10-04 Thread Sohei Okamoto

First of all, $data is a local variable, so it won't change anything
in invalidFields().
Second, even if you modify $this-data, it will not be used in invalidFields().

In the code below, after first if (empty($data)), there is passed data
or copy of $this-data.
Then at if (!empty($data)), $data is never empty because it has either
passed data or copy of $this-data at the beginning, and $data won't
change anyway.

function invalidFields($data = array()) {
if (empty($data)) {
$data = $this-data;
}

if (!$this-beforeValidate()) {
return false;
}

if (!isset($this-validate)) {
return true;
}

if (!empty($data)) {
$data = $data;
} elseif (isset($this-data)) {
$data = $this-data;
}

Populating $this-data is mentioned in here, but at the end, nate
mentioned that We will no longer support calling Model::validates or
Model::invalidFields with parameters. You should set( ) the data, then
call validates( ) or invalidFields( ).
https://trac.cakephp.org/ticket/1040

So I guess we are not supposed to pass data, but set before call.
Still, changes in $this-data in beforeValidate() won't affect in
invalidFields().

I think the fix of using array_merge in here is still needed.
It said it is fixed, but I don't see the array_merge in the fix.

I believe the change in $this-data should be taken in
invalidFields(), so is this a bug?
I've been wondering about this code for a while, so please let me know
I understand it incorrect.

So back to your problem, I am not sure there is a way to get the
changes from beforeValidate(). Either you do that before calling
save() or invalidFields(), or apply the array_merge() fix in
invalidFields().

One more thing, if you are calling parent::beforeValidate(), and if
you have any validation there, I think you should check and return if
it fails:
if (!parent::beforeValidate()) {
return false;
}

I really want to know about the invalidFields code, so if someone has
any idea, please let me know.

Sohei

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



Re: Validation problem

2006-10-02 Thread Sohei Okamoto
In beforeSave(), before returning false, you can do$this-invalidate($field_name);To me, beforeValidate() seems a little more logical place to put that, though.Hope it works for you.Sohei


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


Re: process multiple selected rows

2006-09-29 Thread Sohei Okamoto
If each row corresponds to the data from model which has id field, maybe I would make each checkbox with the row's id as its value,then you will receive the array with selected rows' id.Am I missing anything?
Hope this helps.Sohei

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


Re: Where is the correct place to put this...

2006-09-28 Thread Sohei Okamoto
Like other people said, if you already have data set, count($comments) would be good.If you are only interested to the count and not having the data, then I would do$num_comment = $this-Comment-findCount(array(post_id = $post_id));
$this-set(num_comment, $num_comment);For the formatting functions, if you are formatting data to fit the database format, then I would put them in a component. If you are are formatting data for the view, I would put in a helper.
I think that is the difference and the purpose. Although, I feel that there should be one more thing that combines these two, but that's off topic.Sohei

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


Re: Html helper emits id attribute that i don't want

2006-09-18 Thread Sohei Okamoto
[EMAIL PROTECTED] If it is really causing some problem or bothers you, but you still want to use Html helper,why not write a simple wrapper helper that strip out id attribute when you don't specify?
class HtmlwrapperHelper extends Helper { var $helpers = Array(Html);  function input($fieldName, $htmlAttributes = null, $return = false) { }

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


Re: Html helper emits id attribute that i don't want

2006-09-18 Thread Sohei Okamoto
Sorry, I accidentally sent in the middle.But anyway, do some checking on attributes and preg_replace the output from the Html helper.Would that be a bad practice, or fine approach in Cake?Sohei

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


Re: Copying a db record

2006-09-15 Thread Sohei Okamoto
What is your debug level? Can you turn it to higher and see if there is any warning?I haven't discovered exact cause yet, but I had some problem with excuting same page twicewhen there is session warning about sending header.
Just in case.Sohei

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


Re: cascading deletes.

2006-09-07 Thread Sohei Okamoto
If you are using same version of CakePHP as me (latest one:1.1.7.3363),then the error at line 1019 is with foreach and $records not being an array.$records = $model-findAll($field = '$id', $model-primaryKey, null, null);
foreach($records as $record) { $model-del($record[$data['className']][$model-primaryKey]);}It seems to me that the findAll is return null, probably caused by sql errror somewhere.
You might want to switch DEBUG to 2 to see sql queries executed, or check error log.Hope this help.Sohei

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


Re: selectTag ?empty optiont?

2006-09-07 Thread Sohei Okamoto
The showEmpty option is true by default.?php echo $html-selectTag('File/category_id', $cats, null, null, null, false); ?It is in API
http://api.cakephp.org/class_html_helper.html#0a0a7c56c21b7d7352fd99158350dfc5Sohei

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


Re: Composit forms for composit models

2006-09-06 Thread Sohei Okamoto
Unfortunately, I don't think there is an easy solution for that.However, If you have some sort of custom validation to assert the error, for example in the controller,if( empty($this-data['Person']['Address']['address1']) )
$this-Person-validationErrors['Address']['address1'] = 1;then you can make custom error helper to check such error.For example, make /app/views/helpers/error.php as follows
?phpclass ErrorHelper extends Helper{ function tagErrorMsg($field, $text) {  $error = 1;
  $pieces = explode(/, $field); $keys = ['.implode('][', $pieces).'];  $variable = \$this-validationErrors{$keys};
 $validationError = eval(return {$variable};);  if ($error == $validationError) {   return sprintf('div class=error_message%s/div', is_array($text) ? (empty($text[$error - 1]) ? 'Error in field' : $text[$error - 1]) : $text);
  } else {   return null;  } }}?
Then your controller should include error helper byvar $helpers = array('Html', 'Error');Then in your view (note: use $error instead of $html)
?php echo $html-input('Person/Address/address1', array('id' = 'person_address_address1', 'size' = '40', 'value' = $addresses['Address']['address1'], )) ??php echo $error-tagErrorMsg('Person/Address/address1', 'address is empty.'); ?
The tagErrorMsg is from HTML helper, and I modified the error checking part.It construct variable name to access multidimentional validationErrors array, and get the value. It works for regular 'Model/field' case, too.
I am not sure if it is good code, but it works.Example for custom validation and error helper is athttp://wiki.cakephp.org/tutorials:advanced_validation
and you might want to check the advanced custom validation for your need, too.Hope this helps.Sohei

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


Re: reading table from a component

2006-09-06 Thread Sohei Okamoto
I am not sure exactly what is your intention, but isn't the problem using same name for Model and Component?Either reference must be overwritten in controller.Also, if you want to access to model and/or set data for view,
it should be done through controller, I believe.So, in component, it should be$this-controller-set('product_sections', $this-controller-ProductSection-findAll());Sohei

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


Re: Pagination using multiple models and custom queries

2006-09-06 Thread Sohei Okamoto
I haven't tried this yet, but I think this is what you are looking for.http://wiki.cakephp.org/tutorials:pagination
 It looks promising.Sohei

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


Re: Composit forms for composit models

2006-09-05 Thread Sohei Okamoto
>From what I understand,
HTML helper explodes the input name by slash, and takes the first one as model and second one as field name. The rest of the name is ignored.
Then make the onput tag by
input name=data[%s][%s] %s/
where first %s is model name, second is field name, and the last one is the rest of attributes.

I've seen and used the hack to do exactly what you want to do by using the name as 'Person/Address][address1'This makes the field name as Address][address1 and the name in output tag would be data[Person][Address][address1]

Also, you can fix the setFormTag function in HTML helper by this person's patch
https://trac.cakephp.org/ticket/945

Still, HTML helper will make id as something like Person[Address][Address1, so you still might want to specify it, or make a new helper.Hope this helps.Sohei

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