Re: Sending emoticons from iPhone to CakePHP but received blank value

2012-02-29 Thread Power@IT
I have get some advice bellow:

MySQL before version 5.5 only supports UTF-8 for the BMP, which includes 
characters between U+ and U+. 
It cannot store the character at code point U+1F604 or other similar "high 
characters". MySQL 5.5+ supports utf8mb4, utf16 and utf32, 
which are able to encode these characters. If you're using MySQL 5.5+, use 
one of these column character sets. 

If you are on MySQL < 5.5, you'll have to use a BLOB column type. That type 
stores raw bytes without caring about the "characters" in it. 
The downside is that you won't be able to efficiently search or index the 
text. 

What I have just confirmed now is that emoticons would be stored correctly 
after changed the field type from varchar to blob in our MySQL *5.1.54*. 

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Command history in CakePHP console

2012-02-29 Thread jeremyharris
I don't know of any, but that might be a fun contribution to add :)

I'd create a lighthouse RFC ticket and post some code to see what people 
(and the core team) think. It shouldn't be too hard to code, either.

On Wednesday, February 29, 2012 7:33:58 PM UTC-8, Simon Males wrote:
>
> Hello,
>
> Are there any hacks out there to support command history in CakePHP 
> console?
>
> Closest thing I could find is this: https://github.com/sizuhiko/Taste
> using Facebook's phpsh.
>
> Though it's not supported by 2.0
>
> -- 
> Simon Males
>
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: isAuthorized redirect

2012-02-29 Thread jeremyharris
It would be easier to debug your code with... you know, code. Can you post 
your isAuthorized function please?

On Wednesday, February 29, 2012 3:31:34 PM UTC-8, JT wrote:
>
> I'm using isAuthorized to check if the user is an admin or a user. If a 
> user tries to access an admin function I want them to be redirected to the 
> previous page. However when isAuthorized returns false the user is 
> redirected to '/'. How can I change this behaviour?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using char(36) as a uuid

2012-02-29 Thread dYth
Just in case, i'm using UUID as primary key for branch office. periodically
integrated with database in HO.

On Thu, Mar 1, 2012 at 8:37 AM, Larry E. Masters  wrote:

> check out all of the plugins at http://cakedc.github.com all of them are
> using UUID
>
> --
> Larry E. Masters
>
>
> On Wed, Feb 29, 2012 at 8:53 AM, Ighor Martins wrote:
>
>> Hello,
>>
>> I was thinking about the use of integer as primary key of the table or
>> use a char(36) as UUID in the entire project,
>> What I dont like about the integer, is the auto increment number, So I
>> decided to use char(36) 'cause cake automatically fill it with an UUID, but
>> I dont know if this can slow down the search in DB.
>>
>> So, anyone who used this before, please tell me about that.
>> Is that right to use this in tables like: Users, Cars, Categories?
>>
>>
>> Thanks.
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> 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
>>
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Command history in CakePHP console

2012-02-29 Thread Simon Males
Hello,

Are there any hacks out there to support command history in CakePHP console?

Closest thing I could find is this: https://github.com/sizuhiko/Taste
using Facebook's phpsh.

Though it's not supported by 2.0

-- 
Simon Males

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


isAuthorized redirect

2012-02-29 Thread JT
I'm using isAuthorized to check if the user is an admin or a user. If a 
user tries to access an admin function I want them to be redirected to the 
previous page. However when isAuthorized returns false the user is 
redirected to '/'. How can I change this behaviour?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using char(36) as a uuid

2012-02-29 Thread Larry E. Masters
check out all of the plugins at http://cakedc.github.com all of them are
using UUID

-- 
Larry E. Masters


On Wed, Feb 29, 2012 at 8:53 AM, Ighor Martins wrote:

> Hello,
>
> I was thinking about the use of integer as primary key of the table or use
> a char(36) as UUID in the entire project,
> What I dont like about the integer, is the auto increment number, So I
> decided to use char(36) 'cause cake automatically fill it with an UUID, but
> I dont know if this can slow down the search in DB.
>
> So, anyone who used this before, please tell me about that.
> Is that right to use this in tables like: Users, Cars, Categories?
>
>
> Thanks.
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using char(36) as a uuid

2012-02-29 Thread Greg Skerman
There is some debate that keys should be meaningful, and I get that - but a
UUID is as meaningless as an auto incremented key.

With judicious use of routes, configuration, and other such bits you can
utterly hide your IDs from public scrunity if that is what you're worried
about... personally I find it much easier to navigate to posts/5 as opposed
to posts/aeasd12382nd2jujud3nx3juo3ehu9282 but maybe thats just me.


On Thu, Mar 1, 2012 at 7:26 AM, Miles J  wrote:

> Whats the reason for disliking auto-incrementing numbers? Its probably the
> best thing about databases.
>
>
> On Wednesday, February 29, 2012 6:53:38 AM UTC-8, Ighor Martins wrote:
>>
>> Hello,
>>
>> I was thinking about the use of integer as primary key of the table or
>> use a char(36) as UUID in the entire project,
>> What I dont like about the integer, is the auto increment number, So I
>> decided to use char(36) 'cause cake automatically fill it with an UUID, but
>> I dont know if this can slow down the search in DB.
>>
>> So, anyone who used this before, please tell me about that.
>> Is that right to use this in tables like: Users, Cars, Categories?
>>
>>
>> Thanks.
>>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Date out of the V2.1 Stable

2012-02-29 Thread Miles J
Release candidates for the most part wont change much from the stable 
release. The only differences would be bug fixes, so feel free to use it.

On Tuesday, February 28, 2012 8:33:55 AM UTC-8, fitoussi...@gmail.com wrote:
>
> Hi all, 
>
> I currently work in a web agency and we wonder, when the stable 
> version of 2.1 will come out. For now V2.1 R.C 
> We will work on big projects and big change apparently will be made. 
>
> Thank you in advance for your to answer.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using char(36) as a uuid

2012-02-29 Thread Miles J
Whats the reason for disliking auto-incrementing numbers? Its probably the 
best thing about databases.

On Wednesday, February 29, 2012 6:53:38 AM UTC-8, Ighor Martins wrote:
>
> Hello,
>
> I was thinking about the use of integer as primary key of the table or use 
> a char(36) as UUID in the entire project,
> What I dont like about the integer, is the auto increment number, So I 
> decided to use char(36) 'cause cake automatically fill it with an UUID, but 
> I dont know if this can slow down the search in DB.
>
> So, anyone who used this before, please tell me about that.
> Is that right to use this in tables like: Users, Cars, Categories?
>
>
> Thanks.
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Using char(36) as a uuid

2012-02-29 Thread euromark
it will slow things down and it will store a lot of overhead data (due
to the byte size of those chars compared to integers).
but if speed isnt that big of an issue you are fine.
it gets problematic in the 1 to 5 record area
everything from then on you will really feel - especially with some
more joins going on

in one project the boss wanted to use UUIDs everywhere. database size
is more than twice it would be with AIIDs (due to many foreign_id
fields).
I personally favor a mix (only there where necessary)
but that has other downsites or limitations. so in the end it is a
matter of personal preference as long as the data stays in a specific
range.



On 29 Feb., 15:53, Ighor Martins  wrote:
> Hello,
>
> I was thinking about the use of integer as primary key of the table or use
> a char(36) as UUID in the entire project,
> What I dont like about the integer, is the auto increment number, So I
> decided to use char(36) 'cause cake automatically fill it with an UUID, but
> I dont know if this can slow down the search in DB.
>
> So, anyone who used this before, please tell me about that.
> Is that right to use this in tables like: Users, Cars, Categories?
>
> Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Media Plugin - Getting Started

2012-02-29 Thread nathan
Hi to all, 
I'm trying to handle with video files, but with no luck. 
I'm working on this stuff 
var $validate = array(
'file' => array(
'resource'   => array('rule' => 'checkResource'),
'access' => array('rule' => 'checkAccess'),
'location'   => array('rule' => array('checkLocation', array(
MEDIA_TRANSFER, '/tmp/'
))),
'extension'  => array('rule' => array('checkExtension', false, array(
'jpg', 'jpeg', 'png', 'tif', 'tiff', 'gif', 'pdf', 'tmp','avi','mpeg'
))),
'mimeType'   => array('rule' => array('checkMimeType', false, array(
'image/jpeg', 'image/png', 'image/tiff', 'image/gif', 
'application/pdf','video/x-msvideo','video/vnd.mpegurl','video/mpeg'
);


Il giorno mercoledì 7 luglio 2010 04:26:16 UTC+2, dbme ha scritto:
>
> Awesome! So what is your directory structure (step 3)? 
>
> Is it 
>
> app/webroot/media/static/ 
> app/webroot/media/filter/ 
> app/transfer/ 
>
> OR 
>
> app/webroot/media/static/ 
> app/webroot/media/filter/ 
> app/webroot/media/transfer/ 
>
> Also, did the styles still get served properly after step 5 
> (protecting the transfer directory)? 
>
> I would love to see how you made it work! Would you mind posting an 
> example or emailing me the relevant code? 
> If I can get it working I think it would be great to add this as a 
> full-on tutorial in the wiki. 
>
> Thank you!! 
>
>
> On Jul 6, 6:11 pm, randy  wrote: 
> > So glad to see someone else is taking a crack at this... 
> > 
> > Thanks to your post i was able to make a bit of headway...when i set 
> > this up the first time I had troubles with getting things right in my 
> > bootstrap.php file. However, i had a fairly easy time with other parts 
> > of this, namely the actual file-upload and metadata fields. 
> > 
> > I just set this up again using your instructions for bootstrap.php, 
> > and with just a few more adjustments I have it uploading files to the 
> > transfer directory and spitting out copies of the original, in 
> > different sizes. 
> > 
> > There are just two more things that I want to get working...I'd like 
> > to use the Media Helper to pull in my uploaded images, and, most 
> > importantly, I'd like to get the file-renaming functionality working 
> > so that users don't overwrite each others files. This also makes it 
> > tough to guess filenames if people go fishing for the uploaded images. 
> > 
> > I am running this on a cake 1.3 setup in case anyone was wondering. 
> > 
> > On Jul 5, 1:30 pm, dbme  wrote: 
> > 
> > > I'm just getting started with CakePHP and also David Persson's Media 
> > > plugin (http://github.com/davidpersson/media). I've got my app 
> working 
> > > but I'm having a difficult time getting the Media plugin working. I 
> > > figured I'd start this thread so I could A.) get it working and B.) 
> > > create a reference for beginners like me. 
> > 
> > > Here's what I've done so far (following the README and Configuration 
> > > wiki -http://wiki.github.com/davidpersson/media/configuration). Steps 
> > > marked with a * didn't go as documented :( 
> > 
> > > 1. Download and extract the files to /path/to/your/app/plugins/media 
> > > 2. Include the Media plugin config file in the /path/to/your/app/ 
> > > config/bootstrap.php 
> > 
> > > define ( 'MEDIA_TRANSFER', APP . 'transfer' . DS); 
> > > define ( 'MEDIA_TRANSFER_URL', false); 
> > > require APP . 'plugins/media/config/core.php'; 
> > 
> > > * 3. Create the directory structure using the console 
> > 
> > > cd  /path/to/your/app/ 
> > > ../cake/console/cake media init 
> > 
> > > The Configuration wiki says that there should be a static, filter, and 
> > > transfer directory under the webroot/media/ directory but the command 
> > > above will put the transfer directory under the app directory. Not 
> > > sure if this is how it should be or if I did something wrong. 
> > 
> > > * 4. Copy/move/collect the media into the new location 
> > 
> > > ../cake/console/cake media collect 
> > 
> > > But this results in a bunch of errors :( 
> > 
> > > 
> --- 
> - 
> > > Media Shell 
> > > 
> --- 
> - 
> > > PHP Warning:  Invalid argument supplied for foreach() in 
> /path/to/your/ 
> > > app/plugins/media/vendors/shells/tasks/collect.php on line 119 
> > 
> > > Warning: Invalid argument supplied for foreach() in /path/to/your/app/ 
> > > plugins/media/vendors/shells/tasks/collect.php on line 119 
> > > PHP Notice:  Undefined variable: pluginVendorPaths in /var/www/ 
> > > portfolio/app/plugins/media/vendors/shells/tasks/collect.php on line 
> > > 130 
> > 
> > > Notice: Undefined variable: pluginVendorPaths in /path/to/your/app/ 
> > > plugins/media/vendors/shells/tasks/collect.php on line 130 
> > > PHP Warning:  array_merge(): Argument #1 is not an array in /path/to/ 
> > > your/app/plugins/media/vendors/shells/tasks/collect.php on line 130 
> > 
> > > Warning

Using char(36) as a uuid

2012-02-29 Thread Ighor Martins
Hello,

I was thinking about the use of integer as primary key of the table or use 
a char(36) as UUID in the entire project,
What I dont like about the integer, is the auto increment number, So I 
decided to use char(36) 'cause cake automatically fill it with an UUID, but 
I dont know if this can slow down the search in DB.

So, anyone who used this before, please tell me about that.
Is that right to use this in tables like: Users, Cars, Categories?


Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Model Array index issue

2012-02-29 Thread Waterschaats
It was a version issue, php 5.2.4 was installed While 5.2.8 is
required (cakephp 2).


On 29 feb, 16:39, jeremyharris  wrote:
> Are your versions of PHP the same on both setups? Remember that for PHP
> 4.x, you'll need to define $name in your models.
>
>
>
>
>
>
>
> On Tuesday, February 28, 2012 4:49:18 PM UTC-8, Waterschaats wrote:
>
> > I have a weird problem with Models and array's
>
> > I moved a website from a test server to the live server.
> > In the new situate all my code started to complaine about undefined
> > indexes. When debugging an array I see that the array indexes became
> > numbers instead of the Model names!? What can be the problem of that I
> > use the exact same installation of cakephp?
>
> > Below the 2 examples of arrays.
>
> > this is how the array should be.
> > -
> > Array
> > (
> >     [0] => Array
> >         (
> >             [MenuItemsTemplates] => Array
> >                 (
> >                     [id] => 152
> >                     [menu_item_id] => 1
> >                 )
>
> >         )
>
> > This is the array on the live server
> > 
> > Array
> > (
> >     [0] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 152
> >                     [menu_item_id] => 1
>
> >                 )
>
> >         )
> On Tuesday, February 28, 2012 4:49:18 PM UTC-8, Waterschaats wrote:
>
> > I have a weird problem with Models and array's
>
> > I moved a website from a test server to the live server.
> > In the new situate all my code started to complaine about undefined
> > indexes. When debugging an array I see that the array indexes became
> > numbers instead of the Model names!? What can be the problem of that I
> > use the exact same installation of cakephp?
>
> > Below the 2 examples of arrays.
>
> > this is how the array should be.
> > -
> > Array
> > (
> >     [0] => Array
> >         (
> >             [MenuItemsTemplates] => Array
> >                 (
> >                     [id] => 152
> >                     [menu_item_id] => 1
> >                 )
>
> >         )
>
> > This is the array on the live server
> > 
> > Array
> > (
> >     [0] => Array
> >         (
> >             [0] => Array
> >                 (
> >                     [id] => 152
> >                     [menu_item_id] => 1
>
> >                 )
>
> >         )

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Media PLugin

2012-02-29 Thread jeremyharris
What about setting an empty hidden field in the view, like

echo $this->Form->hidden('Model.file', array('value' => ''));

I'd probably be more prone to just copy and paste the Coupler to my own 
behaviors and modify it, or create a new small behavior that is just 
dedicated to this task.

On Wednesday, February 29, 2012 7:49:01 AM UTC-8, keith...@classoutfit.com 
wrote:
>
> I tried it earlier by adding the following to the end of the beforeSave() 
> in our Users model:
>
> if (!isset($this->data['User']['file'])) { $this->data['User']['file'] = 
> null; }
>
> But when I tested it I discovered that the beforeSave() in the Media 
> Coupler was firing before the beforeSave() in our Users model, so it was 
> too late to add the empty 'file' key to the array as the 'User' had already 
> been unset by the Coupler. I've therefore had to roll the change back and 
> go back to the drawing board for now.
>
> Keith Gorman
> *Class Outfit*
> **
> keithgor...@classoutfit.com
> www.classoutfit.com 
>
> On 29 Feb 2012, at 15:21, jeremyharris wrote:
>
> I probably didn't take your reply the right way. Hopefully I wasn't too 
> harsh myself.
>
> Anyway, hopefully you'll get a response from David soon. Did you ever get 
> to try out passing an empty 'file' key in the form (i.e., a hidden field)? 
> That way, the key would exist and the Coupler wouldn't unset the data. I 
> don't think this is a very elegant solution either, but I was curious if 
> you tried it out.
>
> On Tuesday, February 28, 2012 8:41:39 PM UTC-8, Jeremy Burns wrote:
>>
>> Gosh my reply sounded harsh on you Jeremy - that wasn't my intention. 
>> We've commented out the line that unsets the data and it *all seems fine*, 
>> which also feels dirty. The user records are saving correctly, we can 
>> subsequently add images to user records and all other dedicated image 
>> tables that use the coupler are functioning too. I did reach out to David 
>> yesterday, hoping to learn more from him so that we can implement this 
>> properly and will report back.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> http://www.classoutfit.com
>>  
>> On 28 Feb 2012, at 21:15:25, jeremyharris wrote:
>>
>> I didn't say I agreed with how it worked, I was just explaining what I 
>> think the author's intended use case was. The question was if you were 
>> missing a setting or doing anything wrong. You weren't, so I just threw out 
>> some ideas based on how the Coupler works. Feel free to take it up with the 
>> author or create a Coupler that works for you.
>>
>> I'm glad that an empty image doesn't create garbage data, that thought 
>> was based off of what the Coupler does down the road (check the file and 
>> populate dirname and basename).
>>
>> On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote:
>>>
>>> I understand what you are saying but I don't think it's the full answer. 
>>> It's a perfectly valid use case to have a table that has an optional image 
>>> in it without the need to have a separate join table. The absence of the 
>>> image doesn't create any garbage data; the user row is still valid. A bio 
>>> snap for a user is good example. For the plugin to simply clear the whole 
>>> data array because the optional image fields aren't populated is nuts. If 
>>> the fields are empty simply return true and let the main model get on with 
>>> its work.
>>>
>>> Jeremy Burns
>>> Class Outfit
>>>
>>> http://www.classoutfit.com
>>>  
>>> On 28 Feb 2012, at 15:45:29, jeremyharris wrote:
>>>
>>> It should only unset the data if you are creating the User and it's 
>>> missing the 'file' key. If you are updating, you shouldn't *need* the 
>>> 'file' key.
>>>
>>> That said, you can probably get away with passing an empty (or a path to 
>>> a default image) file key when you are creating the User using a hidden 
>>> field. This should allow the coupler to continue with the save. This may 
>>> save some empty garbage data that is probably unwanted.
>>>
>>> The other solution would be to detach the Coupler behavior at runtime 
>>> when you don't want it to "force" you to have an image.
>>>
>>> The whole point of the Coupler is to tightly couple the physical image 
>>> to the record, so if the image doesn't exist neither should the record. I 
>>> tend to create a separate table for attachments for this very reason. A 
>>> user should be allowed to exist without an image.
>>>
>>> On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote:

 I'm using David Persson's media plugin. I have a users table that 
 contains the fields necessary to link to an image file, but a user 
 does not have to have an image. When I include the Media.Coupler 
 behaviour in the User model User->create always fails on User->save 
 when the user does not have an image because of the beforeSave in 
 coupler.php: 

 function beforeSave(&$Model) { 
 if (!$Model->exists()) { 
 if 
 (!isset($Model->

Re: Media PLugin

2012-02-29 Thread Keith Gorman | Class Outfit
I tried it earlier by adding the following to the end of the beforeSave() in 
our Users model:

if (!isset($this->data['User']['file'])) {
$this->data['User']['file'] = null;
}

But when I tested it I discovered that the beforeSave() in the Media Coupler 
was firing before the beforeSave() in our Users model, so it was too late to 
add the empty 'file' key to the array as the 'User' had already been unset by 
the Coupler. I've therefore had to roll the change back and go back to the 
drawing board for now.

Keith Gorman
Class Outfit

keithgor...@classoutfit.com
www.classoutfit.com

On 29 Feb 2012, at 15:21, jeremyharris wrote:

I probably didn't take your reply the right way. Hopefully I wasn't too harsh 
myself.

Anyway, hopefully you'll get a response from David soon. Did you ever get to 
try out passing an empty 'file' key in the form (i.e., a hidden field)? That 
way, the key would exist and the Coupler wouldn't unset the data. I don't think 
this is a very elegant solution either, but I was curious if you tried it out.

On Tuesday, February 28, 2012 8:41:39 PM UTC-8, Jeremy Burns wrote:
Gosh my reply sounded harsh on you Jeremy - that wasn't my intention. We've 
commented out the line that unsets the data and it *all seems fine*, which also 
feels dirty. The user records are saving correctly, we can subsequently add 
images to user records and all other dedicated image tables that use the 
coupler are functioning too. I did reach out to David yesterday, hoping to 
learn more from him so that we can implement this properly and will report back.

Jeremy Burns
Class Outfit

http://www.classoutfit.com

On 28 Feb 2012, at 21:15:25, jeremyharris wrote:

> I didn't say I agreed with how it worked, I was just explaining what I think 
> the author's intended use case was. The question was if you were missing a 
> setting or doing anything wrong. You weren't, so I just threw out some ideas 
> based on how the Coupler works. Feel free to take it up with the author or 
> create a Coupler that works for you.
> 
> I'm glad that an empty image doesn't create garbage data, that thought was 
> based off of what the Coupler does down the road (check the file and populate 
> dirname and basename).
> 
> On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote:
> I understand what you are saying but I don't think it's the full answer. It's 
> a perfectly valid use case to have a table that has an optional image in it 
> without the need to have a separate join table. The absence of the image 
> doesn't create any garbage data; the user row is still valid. A bio snap for 
> a user is good example. For the plugin to simply clear the whole data array 
> because the optional image fields aren't populated is nuts. If the fields are 
> empty simply return true and let the main model get on with its work.
> 
> Jeremy Burns
> Class Outfit
> 
> http://www.classoutfit.com
> 
> On 28 Feb 2012, at 15:45:29, jeremyharris wrote:
> 
>> It should only unset the data if you are creating the User and it's missing 
>> the 'file' key. If you are updating, you shouldn't *need* the 'file' key.
>> 
>> That said, you can probably get away with passing an empty (or a path to a 
>> default image) file key when you are creating the User using a hidden field. 
>> This should allow the coupler to continue with the save. This may save some 
>> empty garbage data that is probably unwanted.
>> 
>> The other solution would be to detach the Coupler behavior at runtime when 
>> you don't want it to "force" you to have an image.
>> 
>> The whole point of the Coupler is to tightly couple the physical image to 
>> the record, so if the image doesn't exist neither should the record. I tend 
>> to create a separate table for attachments for this very reason. A user 
>> should be allowed to exist without an image.
>> 
>> On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote:
>> I'm using David Persson's media plugin. I have a users table that 
>> contains the fields necessary to link to an image file, but a user 
>> does not have to have an image. When I include the Media.Coupler 
>> behaviour in the User model User->create always fails on User->save 
>> when the user does not have an image because of the beforeSave in 
>> coupler.php: 
>> 
>> function beforeSave(&$Model) { 
>> if (!$Model->exists()) { 
>> if (!isset($Model->data[$Model->alias]['file'])) { 
>>  unset($Model->data[$Model->alias]);  <<<--- 
>> clears down my User 
>> data 
>> return true; 
>> } 
>> } else { 
>> 
>> This is unsetting the User data because the file key is missing. If I 
>> comment out the unset my User->save is successful. The Media.Coupler 
>> is working perfectly well for another table that hasMany images in an 
>> associated table. 
>> 
>> Is there a s

Re: Add class to active links

2012-02-29 Thread jeremyharris
Or ternary!

$class = $active ? 'active' : null;

On Wednesday, February 29, 2012 1:07:08 AM UTC-8, euromark wrote:
>
> just use conditions then 
>
> if ($condition) {} else {} 
>
> basic PHP one-o-one 
>
>
> On 29 Feb., 09:56, Kiran Ambati  wrote: 
> > Hi stephen, 
> > 
> > I want add class to only when URl is active. If we add class in options 
> > array it will be for every time. I want it for only atcive pages 
> > 
> > Thanks, 
> > kiran 
> > 
> > On Wed, Feb 29, 2012 at 1:35 PM, Stephen Speakman < 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > step...@ninjacodermonkey.co.uk> wrote: 
> > > In the options array add 'class' => 'myclass' 
> > 
> > > Echo $this->Html->link('my link', array('controller' => 'users', 
> 'action' 
> > > => 'index'), array('class' => 'mylink')); 
> > 
> > > If my memory serves me correctly that is 
> > 
> > > Sent from my iPhone 
> > 
> > > On 29 Feb 2012, at 07:48, Kiran Ambati  wrote: 
> > 
> > > Hi 
> > 
> > > I am using cakphp 'link' to generate anchor tags. Now i awnt to add a 
> > > class to active links to apply some styling to those links. Is there a 
> way 
> > > to that. 
> > 
> > > -- 
> > > *Thank you,* 
> > > *Kiran.* 
> > 
> > >  -- 
> > > Our newest site for the community: CakePHP Video Tutorials 
> > > http://tv.cakephp.org 
> > > Check out the new CakePHP Questions site  
> > >http://ask.cakephp.organd help others with their CakePHP related 
> > > questions. 
> > 
> > > 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 
> > 
> > >  -- 
> > > Our newest site for the community: CakePHP Video Tutorials 
> > >http://tv.cakephp.org 
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > > others with their CakePHP related questions. 
> > 
> > > 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 
> > 
> > -- 
> > *Thank you,* 
> > *Kiran.*


On Wednesday, February 29, 2012 1:07:08 AM UTC-8, euromark wrote:
>
> just use conditions then 
>
> if ($condition) {} else {} 
>
> basic PHP one-o-one 
>
>
> On 29 Feb., 09:56, Kiran Ambati  wrote: 
> > Hi stephen, 
> > 
> > I want add class to only when URl is active. If we add class in options 
> > array it will be for every time. I want it for only atcive pages 
> > 
> > Thanks, 
> > kiran 
> > 
> > On Wed, Feb 29, 2012 at 1:35 PM, Stephen Speakman < 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > step...@ninjacodermonkey.co.uk> wrote: 
> > > In the options array add 'class' => 'myclass' 
> > 
> > > Echo $this->Html->link('my link', array('controller' => 'users', 
> 'action' 
> > > => 'index'), array('class' => 'mylink')); 
> > 
> > > If my memory serves me correctly that is 
> > 
> > > Sent from my iPhone 
> > 
> > > On 29 Feb 2012, at 07:48, Kiran Ambati  wrote: 
> > 
> > > Hi 
> > 
> > > I am using cakphp 'link' to generate anchor tags. Now i awnt to add a 
> > > class to active links to apply some styling to those links. Is there a 
> way 
> > > to that. 
> > 
> > > -- 
> > > *Thank you,* 
> > > *Kiran.* 
> > 
> > >  -- 
> > > Our newest site for the community: CakePHP Video Tutorials 
> > > http://tv.cakephp.org 
> > > Check out the new CakePHP Questions site  
> > >http://ask.cakephp.organd help others with their CakePHP related 
> > > questions. 
> > 
> > > 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 
> > 
> > >  -- 
> > > Our newest site for the community: CakePHP Video Tutorials 
> > >http://tv.cakephp.org 
> > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
> > > others with their CakePHP related questions. 
> > 
> > > 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 
> > 
> > -- 
> > *Thank you,* 
> > *Kiran.*


On Wednesday, February 29, 2012 1:07:08 AM UTC-8, euromark wrote:
>
> just use conditions then 
>
> if ($condition) {} else {} 
>
> basic PHP one-o-one 
>
>
> On 29 Feb., 09:56, Kiran Ambati  wrote: 
> > Hi stephen, 
> > 
> > I want add class to only when URl is active. If we add class in options 
> > array it will be for every time. I want it for only atcive pages 
> > 
> > Thanks, 
> > kiran 
> > 
> > On Wed, Feb 29, 2012 at 1:35 PM, Stephen Speakman < 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > step...@ninjacodermonkey.co.uk> wrote: 
> > > In the options array add 'class' => 'myclass' 
> > 
> > > Echo $this->Html->link('my link', array('control

Re: Model Array index issue

2012-02-29 Thread jeremyharris
Are your versions of PHP the same on both setups? Remember that for PHP 
4.x, you'll need to define $name in your models.

On Tuesday, February 28, 2012 4:49:18 PM UTC-8, Waterschaats wrote:
>
> I have a weird problem with Models and array's 
>
> I moved a website from a test server to the live server. 
> In the new situate all my code started to complaine about undefined 
> indexes. When debugging an array I see that the array indexes became 
> numbers instead of the Model names!? What can be the problem of that I 
> use the exact same installation of cakephp? 
>
>
> Below the 2 examples of arrays. 
>
> this is how the array should be. 
> - 
> Array 
> ( 
> [0] => Array 
> ( 
> [MenuItemsTemplates] => Array 
> ( 
> [id] => 152 
> [menu_item_id] => 1 
> ) 
>
> ) 
>
> This is the array on the live server 
>  
> Array 
> ( 
> [0] => Array 
> ( 
> [0] => Array 
> ( 
> [id] => 152 
> [menu_item_id] => 1 
>
> ) 
>
> )


On Tuesday, February 28, 2012 4:49:18 PM UTC-8, Waterschaats wrote:
>
> I have a weird problem with Models and array's 
>
> I moved a website from a test server to the live server. 
> In the new situate all my code started to complaine about undefined 
> indexes. When debugging an array I see that the array indexes became 
> numbers instead of the Model names!? What can be the problem of that I 
> use the exact same installation of cakephp? 
>
>
> Below the 2 examples of arrays. 
>
> this is how the array should be. 
> - 
> Array 
> ( 
> [0] => Array 
> ( 
> [MenuItemsTemplates] => Array 
> ( 
> [id] => 152 
> [menu_item_id] => 1 
> ) 
>
> ) 
>
> This is the array on the live server 
>  
> Array 
> ( 
> [0] => Array 
> ( 
> [0] => Array 
> ( 
> [id] => 152 
> [menu_item_id] => 1 
>
> ) 
>
> )

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: MVC design for shopping cart

2012-02-29 Thread jeremyharris
I would simply create a component called Cart and add a read() method to 
just pull the products. Something like this:

class CartComponent extends Object {
var $components = array('Session');
 function read() {
$Product = ClassRegistry::init('Product');
$productsInCart = $this->Session->read('Cart');
$cart = array();
foreach ($productsInCart as $product) {
$cart[] = $Product->read(null, $product);
}
return $cart;
}
 function save($id) {
$productsInCart = $this->Session->read('Cart');
$productsInCart[] = $id;
return $this->Session->save('Cart', $productsInCart);
}
}

Then you access it from the controller and you're good to go. Technically 
it's not MVC since the Cart should be a model, but do you really want to 
write a datasource to pull/save to the Session just for something simple 
like this? I mean, since there will only ever be *one* cart record (from 
the eyes of the user) it doesn't seem to make sense to go to all the 
trouble. Breaking MVC patterns is okay every once in a while :) This 
component would be easily testable and separate from your controller.

On Tuesday, February 28, 2012 1:06:27 PM UTC-8, Christian wrote:
>
> Hi, 
>
> I'm currently trying to create a shopping cart solution with cake 1.3. 
> In the current design, only the product id of a chosen product will be 
> saved in the session, each time the customer lists the cart items, all 
> information needs to be read out of the database. 
> My idea was to create a seperated model (no relation to any table) 
> where all cart calculations can happen in, which can then be used in 
> several controllers. However, this would mean that this cart class 
> would need to use several other product related models (product 
> details, taxes, countrydetails, etc.), which is not easily supported 
> by cake, since it breaks the MVC model. 
> The workaround would be to implement the logic in a controller where I 
> can easily access all models, however, this breaks two other basics, 
> once the "fat model skinny controller" rule and on the other hand the 
> code is not easily reusable for other purposes. 
>
> My question is now how where to implement the cart functionality (e.g. 
> summary price, discount, taxes calculation, etc.) without breaking MVC 
> but with sticking to "fat model skinny controller" and the re- 
> usability of my code. 
>
> Thanks, 
> Christian


On Tuesday, February 28, 2012 1:06:27 PM UTC-8, Christian wrote:
>
> Hi, 
>
> I'm currently trying to create a shopping cart solution with cake 1.3. 
> In the current design, only the product id of a chosen product will be 
> saved in the session, each time the customer lists the cart items, all 
> information needs to be read out of the database. 
> My idea was to create a seperated model (no relation to any table) 
> where all cart calculations can happen in, which can then be used in 
> several controllers. However, this would mean that this cart class 
> would need to use several other product related models (product 
> details, taxes, countrydetails, etc.), which is not easily supported 
> by cake, since it breaks the MVC model. 
> The workaround would be to implement the logic in a controller where I 
> can easily access all models, however, this breaks two other basics, 
> once the "fat model skinny controller" rule and on the other hand the 
> code is not easily reusable for other purposes. 
>
> My question is now how where to implement the cart functionality (e.g. 
> summary price, discount, taxes calculation, etc.) without breaking MVC 
> but with sticking to "fat model skinny controller" and the re- 
> usability of my code. 
>
> Thanks, 
> Christian


On Tuesday, February 28, 2012 1:06:27 PM UTC-8, Christian wrote:
>
> Hi, 
>
> I'm currently trying to create a shopping cart solution with cake 1.3. 
> In the current design, only the product id of a chosen product will be 
> saved in the session, each time the customer lists the cart items, all 
> information needs to be read out of the database. 
> My idea was to create a seperated model (no relation to any table) 
> where all cart calculations can happen in, which can then be used in 
> several controllers. However, this would mean that this cart class 
> would need to use several other product related models (product 
> details, taxes, countrydetails, etc.), which is not easily supported 
> by cake, since it breaks the MVC model. 
> The workaround would be to implement the logic in a controller where I 
> can easily access all models, however, this breaks two other basics, 
> once the "fat model skinny controller" rule and on the other hand the 
> code is not easily reusable for other purposes. 
>
> My question is now how where to implement the cart functionality (e.g. 
> summary price, discount, taxes calculation, etc.) without breaking MVC 
> but with sticking to "fat model skinny controller" and the re- 
> usability of my code. 
>
> Thanks, 
> Christian

-- 
Our newest site for the community: CakePHP Video Tutorials 
http:

Re: Media PLugin

2012-02-29 Thread jeremyharris
I probably didn't take your reply the right way. Hopefully I wasn't too 
harsh myself.

Anyway, hopefully you'll get a response from David soon. Did you ever get 
to try out passing an empty 'file' key in the form (i.e., a hidden field)? 
That way, the key would exist and the Coupler wouldn't unset the data. I 
don't think this is a very elegant solution either, but I was curious if 
you tried it out.

On Tuesday, February 28, 2012 8:41:39 PM UTC-8, Jeremy Burns wrote:
>
> Gosh my reply sounded harsh on you Jeremy - that wasn't my intention. 
> We've commented out the line that unsets the data and it *all seems fine*, 
> which also feels dirty. The user records are saving correctly, we can 
> subsequently add images to user records and all other dedicated image 
> tables that use the coupler are functioning too. I did reach out to David 
> yesterday, hoping to learn more from him so that we can implement this 
> properly and will report back.
>
> Jeremy Burns
> Class Outfit
>
> http://www.classoutfit.com
>  
> On 28 Feb 2012, at 21:15:25, jeremyharris wrote:
>
> I didn't say I agreed with how it worked, I was just explaining what I 
> think the author's intended use case was. The question was if you were 
> missing a setting or doing anything wrong. You weren't, so I just threw out 
> some ideas based on how the Coupler works. Feel free to take it up with the 
> author or create a Coupler that works for you.
>
> I'm glad that an empty image doesn't create garbage data, that thought was 
> based off of what the Coupler does down the road (check the file and 
> populate dirname and basename).
>
> On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote:
>>
>> I understand what you are saying but I don't think it's the full answer. 
>> It's a perfectly valid use case to have a table that has an optional image 
>> in it without the need to have a separate join table. The absence of the 
>> image doesn't create any garbage data; the user row is still valid. A bio 
>> snap for a user is good example. For the plugin to simply clear the whole 
>> data array because the optional image fields aren't populated is nuts. If 
>> the fields are empty simply return true and let the main model get on with 
>> its work.
>>
>> Jeremy Burns
>> Class Outfit
>>
>> http://www.classoutfit.com
>>  
>> On 28 Feb 2012, at 15:45:29, jeremyharris wrote:
>>
>> It should only unset the data if you are creating the User and it's 
>> missing the 'file' key. If you are updating, you shouldn't *need* the 
>> 'file' key.
>>
>> That said, you can probably get away with passing an empty (or a path to 
>> a default image) file key when you are creating the User using a hidden 
>> field. This should allow the coupler to continue with the save. This may 
>> save some empty garbage data that is probably unwanted.
>>
>> The other solution would be to detach the Coupler behavior at runtime 
>> when you don't want it to "force" you to have an image.
>>
>> The whole point of the Coupler is to tightly couple the physical image to 
>> the record, so if the image doesn't exist neither should the record. I tend 
>> to create a separate table for attachments for this very reason. A user 
>> should be allowed to exist without an image.
>>
>> On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote:
>>>
>>> I'm using David Persson's media plugin. I have a users table that 
>>> contains the fields necessary to link to an image file, but a user 
>>> does not have to have an image. When I include the Media.Coupler 
>>> behaviour in the User model User->create always fails on User->save 
>>> when the user does not have an image because of the beforeSave in 
>>> coupler.php: 
>>>
>>> function beforeSave(&$Model) { 
>>> if (!$Model->exists()) { 
>>> if (!isset($Model->data[$Model->alias]['file'])) 
>>> { 
>>>  unset($Model->data[$Model->alias]); 
>>>  <<<--- clears down my User 
>>> data 
>>> return true; 
>>> } 
>>> } else { 
>>>
>>> This is unsetting the User data because the file key is missing. If I 
>>> comment out the unset my User->save is successful. The Media.Coupler 
>>> is working perfectly well for another table that hasMany images in an 
>>> associated table. 
>>>
>>> Is there a setting I need to configure or am I doing something else 
>>> wrong?
>>
>>
>> -- 
>> Our newest site for the community: CakePHP Video Tutorials 
>> http://tv.cakephp.org 
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help 
>> others with their CakePHP related questions.
>>  
>>  
>> 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
>>
>>
>>
> On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote:
>>
>> I understand what you are saying but I don't think

Re: Date out of the V2.1 Stable

2012-02-29 Thread euromark
+1 for the right choice :)


On 29 Feb., 10:57, "fitoussisteph...@gmail.com"
 wrote:
> Thank you for your answers,
>
> It allowed us to see clearer.
> I think we'll produce with V2.1 RC.
>
> we would be delighted to contribute to the development of Cakephp, why
> not :)
>
> again thank you
>
> On 28 fév, 19:51, jeremyharris  wrote:
>
>
>
>
>
>
>
> > Generally the response to this question is: when it's done.
>
> > It's important to understand that CakePHP is a completely volunteer-driven
> > framework. This means that people (core team and otherwise) put in unpaid
> > time after their normal job. Because of this, there isn't a hard and fast
> > release schedule.
>
> > You'll just have to be patient and wait and see. Of course, you can always
> > help it come out faster by closing tickets and contributing :)
>
> > On Tuesday, February 28, 2012 8:33:55 AM UTC-8, fitoussi...@gmail.com wrote:
>
> > > Hi all,
>
> > > I currently work in a web agency and we wonder, when the stable
> > > version of 2.1 will come out. For now V2.1 R.C
> > > We will work on big projects and big change apparently will be made.
>
> > > Thank you in advance for your to answer.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Find condition on Date field

2012-02-29 Thread Kro
Found the solution, not sure if it is the Cake way of doing it but it
works.
$conditions = array('YEAR(MonthlyReturn.month)' => $sel_year); <---
match by year only
$conditions = array('MONTH(MonthlyReturn.month)' => $sel_month); <---
match by month only

On Feb 29, 10:32 am, Kro  wrote:
> Hi,
> I am trying to filter a VIEW by month and year using separate drop
> lists. My code works fine if a year and month selection is made but I
> want to be able to filter based on a selection in either one, i.e. not
> force a selection of both.
> As it stands I am concatenating the year and month selections (day is
> always 01) as follows:
>
> $sel_date = $sel_year.'-'.$sel_month.'-01';
> $conditions = array('MonthlyReturn.month' => $sel_date); <---note
> MonthlyReturn.month is actually aDATEfield
>
> I tried $conditions = array('MonthlyReturn.month.YEAR' => $sel_year);
>
> Is it possible to add aconditionwhich only searches by either month
> or year?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Having issue with AUTH in 2.1

2012-02-29 Thread Rodrigo Rodrigues Moyle
You need to put element sql_dump on your ajax layout too

Em terça-feira, 28 de fevereiro de 2012 11h30min07s UTC-3, heohni escreveu:
>
> I have debug 2. but it will not return a sql statement, it's an ajax 
> based request anyway 
>
> On 28 Feb., 14:02, Rodrigo Rodrigues Moyle  
> wrote: 
> > Set debug to 2 
> > 
> > Em terça-feira, 28 de fevereiro de 2012 06h55min25s UTC-3, heohni 
> escreveu: 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > > well, if I do it like the book says, I get no sql error any more, but 
> > > the if ($this->Auth->login()) fails without any comment. 
> > > In this case, how can I get the sql statement debugged which is 
> > > running? 
> > 
> > > On 28 Feb., 10:33, luca capra  wrote: 
> > > > Il 28/02/2012 09:55, heohni ha scritto: 
> > 
> > > > > I did this, see above? 
> > 
> > > > > On 28 Feb., 09:36, "@dariobarila"  wrote: 
> > > > >> Hello, 
> > > > >> try to configure the Auth fields on the same level of 
>  $components = 
> > > > >> array('Auth'); 
> > 
> > > > >> On 28 Feb, 09:33, heohni 
> > >  wrote: 
> > > > >> ... 
> > > > >>>  $this->Auth->fields = array('username' => 
>  'usr_username', 
> > > > >>> 'password' =>  'usr_password'); 
> > > > >>>  $this->Auth->allowedActions = array('display', 'index', 
> > > > >>> 'add'); 
> > > > >>>  $this->Auth->autoRedirect = false; 
> > > > >>>  $this->Auth->logoutRedirect = array('controller' => 
> > > > >>> 'bookmark', 'action' =>  'search'); 
> > > > >>>  $this->Auth->loginRedirect = array('controller' => 
> > >  'pages', 
> > > > >>> 'action' =>  'display', 'home'); 
> > > > >>>  } 
> > 
> > > > >>> ... 
> > > > >>> SELECT `User`.`usr_id`, `User`.`usr_username`, 
> > > `User`.`usr_password`, 
> > > > >>> `User`.`created` FROM `project`.`users` AS `User`   WHERE 
> > > > >>> `User`.`username` = 'me' AND `User`.`password` = 
> > > > >>> '998992c0dfcffb9ad442a85be2d636ba37228c3d'LIMIT 1 
> > 
> > > > I think he means something like (read the book): 
> > 
> > > > $components = array( 
> > > >'Auth' =>  array( 
> > > >  'authenticate' =>  array( 
> > > >  'Form' =>  array( 
> > > >  "fields" =>  array( 
> > > >  'username' =>  'usr_nameuser', 
> > > >  'password' =>  'usr_wordpass' 
> > > >  ), 
> > > >  ) 
> > > > ), 
> > > > );

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: ckeditor+ckfinder config problem

2012-02-29 Thread leugimdr
i havethe same problem with  the "admin" prefix, any idea??



El día 30 de septiembre de 2011 14:57, Sam Sherlock
 escribió:
> your possibly missing the webroot part within your ckeditor settings
>  - S
>
>
>
>
>
>
> On 29 September 2011 05:31, ms_liz_87  wrote:
>>
>> Anyone can help me..? I cant upload image using ckeditor. I already
>> install ckfinder with it. when i click on upload button, my path will
>> be missing. Anyone have any idea how to config it?
>>
>> --
>> Our newest site for the community: CakePHP Video Tutorials
>> http://tv.cakephp.org
>> Check out the new CakePHP Questions site http://ask.cakephp.org and help
>> others with their CakePHP related questions.
>>
>>
>> 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
>
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Sending emoticons from iPhone to CakePHP but received blank value

2012-02-29 Thread Power@IT
Sorry, everone. It's my fault that I think it could not received at php. 

In fact, CakePHP could receive it, but the problem is when inserted into 
MySQL table, 
the emoticons become blank in table field(varchar). 
What I inserting into is something like *\Ud83d\Ude04* which is just a 
usual smile icon in iPhone. 

How could I escape it? It is something like json encoding/decoding. Thanks 

2012年2月29日水曜日15時21分02秒 UTC+9 Power@IT:
>
> Hello, everybody.
>
> I am developing an iPhone app that would send emoticons from iPhone to 
> server-side.
>
> But, what the server-side received everytime is always null(or blank?).
>
> I referred 
> here
>  at 
> SO but with no help.
> I also referred HTML_Emoji but it seems to be not an simple encoding or 
> escape character issue.
>
> Is it an issue about carrier's emoticons codes?
>
> So, how could I receive the right emoticons in CakePHP?
> Or its not an issue just in CakePHP framework but in PHP or Java or any 
> language else?
>
> What I am developing is the webservice(server-side), and the development 
> of iPhone app is other partner.What sending from iPhone is no problem by 
> theirs saying and with log output(such as \Ud83c\Udfe7) in Xcode when 
> debugging, but I just receive them at server-side with blank value.
>
> By the way, one message sending from our iPhone app with just plain text, 
> it could be received correctly(received by $_POST in CakePHP);
> with emoticons in the message, what php received is only plain text 
> without emoticons in it.
>
> Thanks.
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Find condition on Date field

2012-02-29 Thread Kro
Hi,
I am trying to filter a VIEW by month and year using separate drop
lists. My code works fine if a year and month selection is made but I
want to be able to filter based on a selection in either one, i.e. not
force a selection of both.
As it stands I am concatenating the year and month selections (day is
always 01) as follows:

$sel_date = $sel_year.'-'.$sel_month.'-01';
$conditions = array('MonthlyReturn.month' => $sel_date); <---note
MonthlyReturn.month is actually a DATE field

I tried $conditions = array('MonthlyReturn.month.YEAR' => $sel_year);

Is it possible to add a condition which only searches by either month
or year?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Date out of the V2.1 Stable

2012-02-29 Thread fitoussisteph...@gmail.com
Thank you for your answers,

It allowed us to see clearer.
I think we'll produce with V2.1 RC.

we would be delighted to contribute to the development of Cakephp, why
not :)

again thank you

On 28 fév, 19:51, jeremyharris  wrote:
> Generally the response to this question is: when it's done.
>
> It's important to understand that CakePHP is a completely volunteer-driven
> framework. This means that people (core team and otherwise) put in unpaid
> time after their normal job. Because of this, there isn't a hard and fast
> release schedule.
>
> You'll just have to be patient and wait and see. Of course, you can always
> help it come out faster by closing tickets and contributing :)
>
>
>
>
>
>
>
> On Tuesday, February 28, 2012 8:33:55 AM UTC-8, fitoussi...@gmail.com wrote:
>
> > Hi all,
>
> > I currently work in a web agency and we wonder, when the stable
> > version of 2.1 will come out. For now V2.1 R.C
> > We will work on big projects and big change apparently will be made.
>
> > Thank you in advance for your to answer.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Add class to active links

2012-02-29 Thread euromark
just use conditions then

if ($condition) {} else {}

basic PHP one-o-one


On 29 Feb., 09:56, Kiran Ambati  wrote:
> Hi stephen,
>
> I want add class to only when URl is active. If we add class in options
> array it will be for every time. I want it for only atcive pages
>
> Thanks,
> kiran
>
> On Wed, Feb 29, 2012 at 1:35 PM, Stephen Speakman <
>
>
>
>
>
>
>
>
>
> step...@ninjacodermonkey.co.uk> wrote:
> > In the options array add 'class' => 'myclass'
>
> > Echo $this->Html->link('my link', array('controller' => 'users', 'action'
> > => 'index'), array('class' => 'mylink'));
>
> > If my memory serves me correctly that is
>
> > Sent from my iPhone
>
> > On 29 Feb 2012, at 07:48, Kiran Ambati  wrote:
>
> > Hi
>
> > I am using cakphp 'link' to generate anchor tags. Now i awnt to add a
> > class to active links to apply some styling to those links. Is there a way
> > to that.
>
> > --
> > *Thank you,*
> > *Kiran.*
>
> >  --
> > Our newest site for the community: CakePHP Video Tutorials
> > http://tv.cakephp.org
> > Check out the new CakePHP Questions site 
> >http://ask.cakephp.organd help others with their CakePHP related
> > questions.
>
> > 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
>
> >  --
> > Our newest site for the community: CakePHP Video Tutorials
> >http://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help
> > others with their CakePHP related questions.
>
> > 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
>
> --
> *Thank you,*
> *Kiran.*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Add class to active links

2012-02-29 Thread Kiran Ambati
Hi stephen,

I want add class to only when URl is active. If we add class in options
array it will be for every time. I want it for only atcive pages

Thanks,
kiran

On Wed, Feb 29, 2012 at 1:35 PM, Stephen Speakman <
step...@ninjacodermonkey.co.uk> wrote:

> In the options array add 'class' => 'myclass'
>
> Echo $this->Html->link('my link', array('controller' => 'users', 'action'
> => 'index'), array('class' => 'mylink'));
>
> If my memory serves me correctly that is
>
> Sent from my iPhone
>
> On 29 Feb 2012, at 07:48, Kiran Ambati  wrote:
>
> Hi
>
> I am using cakphp 'link' to generate anchor tags. Now i awnt to add a
> class to active links to apply some styling to those links. Is there a way
> to that.
>
> --
> *Thank you,*
> *Kiran.*
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site 
> http://ask.cakephp.org and help others with their CakePHP related
> questions.
>
>
> 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
>
>  --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> 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
>



-- 
*Thank you,*
*Kiran.*

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Sending emoticons from iPhone to CakePHP but received blank value

2012-02-29 Thread Power@IT
Hello, everybody.

I am developing an iPhone app that would send emoticons from iPhone to 
server-side.

But, what the server-side received everytime is always null(or blank?).

I referred 
here
 at 
SO but with no help.
I also referred HTML_Emoji but it seems to be not an simple encoding or 
escape character issue.

Is it an issue about carrier's emoticons codes?

So, how could I receive the right emoticons in CakePHP?
Or its not an issue just in CakePHP framework but in PHP or Java or any 
language else?

What I am developing is the webservice(server-side), and the development of 
iPhone app is other partner.What sending from iPhone is no problem by 
theirs saying and with log output(such as \Ud83c\Udfe7) in Xcode when 
debugging, but I just receive them at server-side with blank value.

By the way, one message sending from our iPhone app with just plain text, 
it could be received correctly(received by $_POST in CakePHP);
with emoticons in the message, what php received is only plain text without 
emoticons in it.

Thanks.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Add class to active links

2012-02-29 Thread euromark
didnt you find the cookbook?
http://book.cakephp.org/2.0/en/


On 29 Feb., 09:05, Stephen Speakman 
wrote:
> In the options array add 'class' => 'myclass'
>
> Echo $this->Html->link('my link', array('controller' => 'users',
> 'action' => 'index'), array('class' => 'mylink'));
>
> If my memory serves me correctly that is
>
> Sent from my iPhone
>
> On 29 Feb 2012, at 07:48, Kiran Ambati  wrote:
>
>
>
>
>
>
>
> > Hi
>
> > I am using cakphp 'link' to generate anchor tags. Now i awnt to add
> > a class to active links to apply some styling to those links. Is
> > there a way to that.
>
> > --
> > Thank you,
> > Kiran.
>
> > --
> > Our newest site for the community: CakePHP Video 
> > Tutorialshttp://tv.cakephp.org
> > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd
> > help others with their CakePHP related questions.
>
> > 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

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Add class to active links

2012-02-29 Thread Stephen Speakman

In the options array add 'class' => 'myclass'

Echo $this->Html->link('my link', array('controller' => 'users',  
'action' => 'index'), array('class' => 'mylink'));


If my memory serves me correctly that is

Sent from my iPhone

On 29 Feb 2012, at 07:48, Kiran Ambati  wrote:


Hi

I am using cakphp 'link' to generate anchor tags. Now i awnt to add  
a class to active links to apply some styling to those links. Is  
there a way to that.


--
Thank you,
Kiran.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and  
help others with their CakePHP related questions.



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


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.



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


Re: MVC design for shopping cart

2012-02-29 Thread Stephen Speakman
Write re-usable query methods in the appropriate models. If you're  
dealing with product id's then use the products controller and any tax  
calculations etc can be handled in a model or if need be component.


Im not sure why you would need a 'cart controller' if you don't have  
cart records.


If you really need a table for this functionality look up temporary  
mysql tables, but i wouldn't recommend using $this->query instead i'd  
write efficent querys and index my tables


My 2 cents...

Sent from my iPhone

On 28 Feb 2012, at 21:06, Christian  wrote:


Hi,

I'm currently trying to create a shopping cart solution with cake 1.3.
In the current design, only the product id of a chosen product will be
saved in the session, each time the customer lists the cart items, all
information needs to be read out of the database.
My idea was to create a seperated model (no relation to any table)
where all cart calculations can happen in, which can then be used in
several controllers. However, this would mean that this cart class
would need to use several other product related models (product
details, taxes, countrydetails, etc.), which is not easily supported
by cake, since it breaks the MVC model.
The workaround would be to implement the logic in a controller where I
can easily access all models, however, this breaks two other basics,
once the "fat model skinny controller" rule and on the other hand the
code is not easily reusable for other purposes.

My question is now how where to implement the cart functionality (e.g.
summary price, discount, taxes calculation, etc.) without breaking MVC
but with sticking to "fat model skinny controller" and the re-
usability of my code.

Thanks,
Christian

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and  
help others with their CakePHP related questions.



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


--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.



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