Re: Sending a 404 header from the controller
On Fri, Jul 11, 2014 at 2:31 PM, Alex Bovey wrote: > > Hello all, > > I would like one of my controller methods to be able to send a 404 Not Found > header, but still render the view as normal. I've tried both of the > following at the beginning of my controller method, but Cake is still > returning a 200 OK header: > > $this->response->header('HTTP/1.1 404 Not Found'); > $this->response->httpCodes(404); Solved. For anyone that finds this in future the function is $this->response->statusCode(404) not $this->response-> httpCodes(404). Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Sending a 404 header from the controller
Thank you Leandro - I can't see where that outputs a 404 header though? Alex On Fri, Jul 11, 2014 at 3:09 PM, Leandro Machado Pereira < llperei...@gmail.com> wrote: > You should see this http://pastebin.com/zNB6SFg7 > > > 2014-07-11 10:31 GMT-03:00 Alex Bovey : > >> Hello all, >> >> I would like one of my controller methods to be able to send a 404 Not >> Found header, but still render the view as normal. I've tried both of the >> following at the beginning of my controller method, but Cake is still >> returning a 200 OK header: >> >> $this->response->header('HTTP/1.1 404 Not Found'); >> $this->response->httpCodes(404); >> >> Please note that I don't just want to do a custom 404 page - I still want >> to render the page using the current controller method. >> >> I am using Cake 2.4. >> >> Any help would be much appreciated. >> >> Thanks all, >> >> Alex >> >> -- >> 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | >> Hosting >> >> -- >> Like Us on FaceBook https://www.facebook.com/CakePHP >> Find us on Twitter http://twitter.com/CakePHP >> >> --- >> You received this message because you are subscribed to the Google Groups >> "CakePHP" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to cake-php+unsubscr...@googlegroups.com. >> To post to this group, send email to cake-php@googlegroups.com. >> Visit this group at http://groups.google.com/group/cake-php. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > > > http://leandrompereira.com.br > > ***Se você pretende redirecionar este e-mail, por favor, apague todos os > endereços que aparecem nele. Outra dica de segurança é endereçá-lo no Cco. > Desta forma você estará protegendo a mim, seus amigos e a você mesmo. Eu e > a Campanha Contra o SPAM agradecemos.Não envie correntes.*** > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to cake-php+unsubscr...@googlegroups.com. > To post to this group, send email to cake-php@googlegroups.com. > Visit this group at http://groups.google.com/group/cake-php. > For more options, visit https://groups.google.com/d/optout. > -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Sending a 404 header from the controller
Hello all, I would like one of my controller methods to be able to send a 404 Not Found header, but still render the view as normal. I've tried both of the following at the beginning of my controller method, but Cake is still returning a 200 OK header: $this->response->header('HTTP/1.1 404 Not Found'); $this->response->httpCodes(404); Please note that I don't just want to do a custom 404 page - I still want to render the page using the current controller method. I am using Cake 2.4. Any help would be much appreciated. Thanks all, Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Ejemplo de proyecto en cakephp
Amigos: Alguien tiene un ejemplo de un login en cakephp y mysql que me haga el favor y me lo pase. Si tiene el ejemplo del blog para descargarlo también le agradeceria muchas gracias -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Form helper not adding "required" class to fields from deep model associations
Anyone? :) On Fri, May 17, 2013 at 4:04 PM, Alex Bovey wrote: > Hi all, > > In my Cake 2.3 app I'm using saveAll($this->request->data, array('deep' => > true)) to save deep model associations and the validation is working fine. > My input fields for any deeply associated models have the error class > applied if I try to submit the form having left them blank, which is great. > > The problem is that the Form helper isn't adding the "required" class to > the div of any deeply associated models - e.g.: > > - > > echo $this->Form->create('MyModel'); > echo $this->Form->input('MyModel.required_field); // this field correctly > has the "required" class :-) > echo $this->Form->input('MyRelatedModel.required_field); // this field > also has the "required" class :-) > echo $this->Form->input('MyRelatedModel.AnotherModel.required_field); // > this field does NOT have the "required" class :-( > > - > > Does anyone know of a solution? > > Thanks! > > Alex > > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Form helper not adding "required" class to fields from deep model associations
Hi all, In my Cake 2.3 app I'm using saveAll($this->request->data, array('deep' => true)) to save deep model associations and the validation is working fine. My input fields for any deeply associated models have the error class applied if I try to submit the form having left them blank, which is great. The problem is that the Form helper isn't adding the "required" class to the div of any deeply associated models - e.g.: - echo $this->Form->create('MyModel'); echo $this->Form->input('MyModel.required_field); // this field correctly has the "required" class :-) echo $this->Form->input('MyRelatedModel.required_field); // this field also has the "required" class :-) echo $this->Form->input('MyRelatedModel.AnotherModel.required_field); // this field does NOT have the "required" class :-( - Does anyone know of a solution? Thanks! Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Using Tree behavior with Postgres database
Hi all, I am using Postgres for the first time and I am running into problems when using the Tree behavior on my Page model. I am familiar with the Tree behavior and have used it many times with MySQL so I know my pages table is set up correctly. I can insert new records and the lft, rght and parent_id fields appear to be updating OK, but when I run the recover() function on the tree, or I try to use moveUp() or moveDown() I get an error from a specific query: ERROR: column "Page.lft" must appear in the GROUP BY clause or be used in an aggregate function ^ In statement: SELECT MAX("Page"."rght") AS "rght" FROM "public"."pages" AS "Page" WHERE 1 = 1 ORDER BY "Page"."lft" ASC LIMIT 1 Anyone encountered this before or know of a solution? Thanks very much, Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
On Tue, Apr 23, 2013 at 7:26 PM, André Luis wrote: > > I suggest to use a single model and separate the users using groups... Thanks André - best plan I think. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Using Auth component with two different models
On Fri, Apr 19, 2013 at 4:39 PM, Alex Bovey wrote: > Hi all, > > What's the best technique to use if I have two separate areas of my site and > I want the Auth component to use two separate models to log in to those > areas? > > I have tried setting the $this->Auth->authenticate['Form']['userModel'] from > the controller but that doesn't seem to have any effect... Hi all - any thoughts on this one? Thanks! Alex -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Using Auth component with two different models
Hi all, What's the best technique to use if I have two separate areas of my site and I want the Auth component to use two separate models to log in to those areas? I have tried setting the $this->Auth->authenticate['Form']['userModel'] from the controller but that doesn't seem to have any effect... Thanks all, Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Content moderation in CakePHP
On Wed, Apr 10, 2013 at 2:33 PM, Christian Cadéré wrote: > One solution : use the Revision Behavior that stores revisions of any > model you want : > http://bakery.cakephp.org/articles/alkemann/2008/12/18/revision-behavior-revision-control-made-easy > You will have to make a special table for posts_revs where all revisions > of posts will be stored, but that way you will be able to fetch any version > you want of your posts. In your case it will be the last validated one, but > you will be able to use it for further functionalities. > Hi Christian, Thanks very much for your reply and advice also - revision behavior looks like it might do the best job so I'll take a closer look at that now. Thanks for the suggestion. Alex -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Content moderation in CakePHP
On Wed, Apr 10, 2013 at 6:15 PM, Vinicius Dusso wrote: > > I guess you can create a schema similar which Drupal uses. > It would be something like this: > > 1. Create two tables: *posts *and *post_revisions*. > 2. Posts table would store all new data. When a new post is created, it > would be stored there. > 3. To edit a lastest post's version, you could simply edit the Post entry. > 4. When a moderator approves a Post, you would create a entry in Post > Revisions table. You can do this simply using the beforeSave model callback. > > This way you can handle separated the moderated and unmoderated entries, > without checkin any boolean field. > > Hi Vinícius, Thanks very much for your reply and advice - sounds pretty sensible, and actually sounds pretty similar to the revision behavior that Christian suggested. Thanks for the advice, Alex -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Content moderation in CakePHP
Hello all, I'm just wondering how best to approach content moderation and wondered whether anyone that has done something similar could offer any advice? For example, I have Users that have many Posts. Whenever a Post is added it needs to be approved before being published (easy), but also when a Post is edited the changes will need to be held in moderation before being published. Whilst awaiting moderation, the previous version of the Post should stay live on the site until the new version is published. Also if a User edits a Post that is currently awaiting moderation, they should be presented with the latest (unmoderated) version to edit instead of the current live version. For this scenario Posts do not HABTM Tags, which keeps it simpler. So far I have thought of two approaches: 1) Have two tables for Posts and ModeratedPosts and a ModeratedPost belongsTo a Post. A Post only becomes a ModeratedPost when it has been approved. 2) Store both Posts and ModeratedPosts in the same table with a 'moderated' boolean. I would still need some way of linking records together so that a Post belongsTo a ModeratedPost. Any thoughts welcome! Thanks in advance, Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
User login after register does not work
Hello, in my opinion website usability wants me to log in my users right after registration. It makes no sense to force them to reenter their log in information after they already filled out the registration form successfully. public function signup() { if ($this->request->is('post')) { $this->User->create(); if ($this->User->save($this->request->data)) { if ($this->Auth->login()) { $this->redirect($this->Auth->redirect()); } else { $this->Session->setFlash(__('The user could not be saved. Please, try again.')); } } } In this code $this->Auth->login() just returns false. The User is saved correctly however. public function signup() { if ($this->request->is('post')) { $this->User->create(); if ($this->User->save($this->request->data)) { if ($this->Auth->login($this->request->data)) { $this->redirect($this->Auth->redirect()); } else { $this->Session->setFlash(__('The user could not be saved. Please, try again.')); } } } In this code the Auth and the Session only contains field that are also in $this->request->data, but not other fields of User like "id". Both examples above do not do what i want. I need ALL fields of User right after registration/signup, including "id" and others. My view(parsed) looks like this: Name Email Passwort Passwort Sign Up And last but not least in my AppController: public $components = array( 'Session', 'Auth' => array( 'loginRedirect' => array('controller' => 'users', 'action' => 'settings'), 'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home'), 'authenticate' => array( 'Form' => array( 'fields' => array('username' => 'email') ) ) ) ); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Place a verification file http://example.com/verificationfile.html
Just put it in the app/webroot folder On Thu, Nov 8, 2012 at 1:34 AM, Justus Kersey wrote: > To verify my website on pinterest, I need to place an html file in my root. > > This is the message I keep getting: > > *Your server responded with a status code of 404 (file not found). We > tried to visit the file at http://wallshops.com/pinterest-.html.* > > Where should I place the file, and what do I need to do so that file can > be seen by pinterest??? > > -- > Like Us on FaceBook https://www.facebook.com/CakePHP > Find us on Twitter http://twitter.com/CakePHP > > --- > You received this message because you are subscribed to the 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. > 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Copy branch of Tree to another parent
On Wed, Oct 24, 2012 at 2:46 PM, bs28723 wrote: > I guess nobody know of an easy way to do this? > nobody has ever written a routine to do this? > Last hope before I dive into this > Thanks > Bill Try this Bill - I ain't saying it's elegant :) http://pastebin.com/vYNExjZ2 -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Copy branch of Tree to another parent
On Mon, Oct 22, 2012 at 1:19 PM, bs28723 wrote: > Sorry, if my question was not clear. > > I want to "copy" the entire branch to another location. So, if I want to > copy a branch that has 5 children, > then I need to create the new parent node first, then once I have this ID, I > can then create the 5 children nodes. > That is a fairly easy example. But what about a branch that has 4 levels > and 5 nodes? > > Is seems like I have to walk the original tree and create each node, then > sub-node, then leaf, etc, etc. > Anyone done this before? Any suggestions? Hi Bill, Yes I have done this before, but I didn't find an elegant solution so I did exactly what you mention and walked the tree (to a fixed depth) and inserted the nodes. I'll post the code up somewhere now just in case it saves you a bit of time, but it's pretty ugly. I know what you mean though - it seems to be a pretty common requirement so I'm surprised there isn't a more obvious way of doing it. I guess using find('threaded') and unsetting the parent_ids didn't work? Thanks, Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Change created/modified to unix time
> > Where are you doing these searches? If in the database I don't think > there would be much of a performance hit. > The searches are within the database yes, the problem is that "not much of a performance hit" isn't ideal when carrying out a large number of searches. > > You could do a conversion in AppModel::afterFind and add a new key, > 'timestamp' to the data for each record. Or you could even have the > database include it in the results for you, for that matter. > Converting it after performing the search wouldn't help the performance of the search unfortunately. > > > I realise there may be the excuse that formatting would be required as > unix > > timestamps are unreadable, but this is also the case with the current > setup > > as how many people use -MM-DD HH:MM:SS when displaying dates? it's > > usually DD-MM- or MM-DD-. > > No it's not usually those formats. -MM-DD is an ISO standard for > good reason. It sorts naturally, for one thing. Another obvious reason > is right there in your comment: "DD-MM- or MM-DD-" Yes? Which > is it then? They're ambiguous, so should be avoided. > Sorry by usually I'm referring to US/UK, I have a slight bias :) > > Now, if only some countries would also adopt the metric system. ;-) > > > What does everyone else think? > > > > Is there a way to convert the current created/modified fields to UNIX > > timestamps with current CakePHP? > > I'll leave it for someone else to say. I know that I have seen where > that is set but cannot remember now. > -- 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
Change created/modified to unix time
Hi, I currently make use of the created and modified fields throughout my application but being datetime fields, performing searches/comparisons isn't as fast as they could be if unix timestamps were used. I realise there may be the excuse that formatting would be required as unix timestamps are unreadable, but this is also the case with the current setup as how many people use -MM-DD HH:MM:SS when displaying dates? it's usually DD-MM- or MM-DD-. What does everyone else think? Is there a way to convert the current created/modified fields to UNIX timestamps with current CakePHP? -- 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
Geocoding
Hi all, What behavior / component / plugin is everyone using for geocoding these days? I want to use either Yahoo or Google Maps and I've found a bakery article from Nate in 2007 but can't find the actual behavior anywhere: http://bakery.cakephp.org/articles/nate/2007/04/13/geocoding-in-cakephp As that was 5 years ago I guess there might be a more evolved solution now anyway? THanks, Alex -- 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 | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress -- 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
Using oAuth 2.0
Hello, I have to authenticate and access data from a webservice using oAuth 2.0. Have anyone some examples to do that using CakePHP ? Thanks Alex -- 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
Ampersands in URLs with CakePHP and Apache mod_rewrite
Hi all, I'm experiencing problems when using ampersands in named parameters (Cake 1.3) which is a well known mod_rewrite problem. e.g. if I request www.mysite.com/test/search:this%26that Apache rewrites it to: webroot/index.php?search:this&that That means it's not parsed correctly by CakePHP, as the ampersand in the URL treats the query string as separate name / value pairs. I don't want to double escape the ampersand as this results in ugly URLs. Apache introduced a B flag to rewrite rules in version 2.2.7 which solves the problem but it's shared hosting and they won't upgrade to that. I also tried the NE (no escape) rule but that didn't seem to make any difference. Anyone experienced the same problem and found a good solution? Thanks, Alex -- 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: DebugKit Toolbar - core processing (derived)
Anyone? :) On Thu, Dec 29, 2011 at 3:41 PM, Alex Bovey wrote: > Hi all, > > I've just moved a site (at the client's request) from my own VPS where it > was performing very well to some cheap shared hosting (123-reg.co.uk) and > surprise surprise it's pretty slow. > > Using the DebugKit Toolbar I'm seeing a massive performance hit in core > processing (derived) on the timeline - it's taking up to 40 seconds! Any > pointers for where to start looking for the cause of this? > > Thanks all, > > Alex > > -- > Alex Bovey > Web Developer | Alex Bovey Consultancy Ltd > Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 > > > -- 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
DebugKit Toolbar - core processing (derived)
Hi all, I've just moved a site (at the client's request) from my own VPS where it was performing very well to some cheap shared hosting (123-reg.co.uk) and surprise surprise it's pretty slow. Using the DebugKit Toolbar I'm seeing a massive performance hit in core processing (derived) on the timeline - it's taking up to 40 seconds! Any pointers for where to start looking for the cause of this? Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 -- 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: Best image resize and crop helper
On Fri, Dec 2, 2011 at 9:34 AM, AD7six wrote: > > That's quite a common way of thinking about upload processing. > > Why would you run logic each time you want to point at an image - instead > of once when you upload it such that your helper/image logic is only "the > $size thumbnail for that file is here: "$domain/$path.$size.$ext"? > That's logical - thanks Andy. -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 -- 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: Best image resize and crop helper
On Thu, Dec 1, 2011 at 6:41 PM, Miles J wrote: > This should be done when the image is uploaded. Thanks for the responses all. Miles - I'm interested to know your rationale for that approach, which I always used to follow, but find a helper so much more convenient when you want to make a minor adjustment to the image size. What happens when you find you need a different size for whatever reason? Do you simply have a function that lets you regenerate all images to a certain size, presuming you keep the originally uploaded image? Thanks, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 -- 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
Best image resize and crop helper
Hi all, What's everyone's favourite method (helper or otherwise) or resizing and cropping images? Thanks, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 -- 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
Infinite re-direct during login
Hi, First of all, I don't have any experience with CakePHP. I know PHP itself but that is clearly not enough. I'm completely lost on this. At work, I inherited this application that was developed using CakePHP 0.2.9. The application was working fine until 2 to 3 weeks ago, when started having this problem (see below). Nobody else has access to the application to change anything so it was not caused by code changes (all files within the application are dated 2009). I contacted the server's administrators to ask if any updates/upgrades/changes have been done to the server, PHP and/or MySQL but they said none. The problem is simple. When I get in to the site (http:// www.mysite.com/, it automatically tries to redirects to the login page. If I simply type http://www.mysite.com/ it returns saying that page http://www.mysite.com/login not found. If I type http://www.mysite.com/index.php it crashes. In Firefox, it says "Firefox has detected that the server is redirecting the request for this address in a way that will never complete" In Chrome it says "The webpage http://www.mysite.com/index.php/login/login/login/login/login... has resulted in too many redirects. (...)" BTW, the server runs PHP 5.2.13. Any ideas on what might have caused this problem outside code? What other information can I give to help you help me? Thanks, Alex -- 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: DebugKit Toolbar timeline isn't adding up
On Sun, Oct 30, 2011 at 4:59 PM, AD7six wrote: > > It doesn't necessarily have to add up. Timers have a start and an end > time - and apparently a lot happened inbetween your controller action > and the render process. Thanks Andy - it's a good point. > > Any ideas where this may be coming from? This is v1.2.7. > > Well that's an old version of cake. Granted. > Maybe by investigating the old fashioned way - from the numbers you've > posted you can start by investigating if it comes from: some code that > gets executed inbetween your controller and view rendering. I'm not overly familiar with Cake's core architecture, so what code would this be? i.e. something in component / helper / behavior? I was wrongly under the impression that the rendering would start as soon as the controller action had finished... > If debug kit is not the first component in your components array > (that's a bad idea), that would explain both the holes and the numbers > - I'd fix that first if I were you. It wasn't the first component but it is now! Thanks for any help you can give Andy. -- 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
DebugKit Toolbar timeline isn't adding up
Hi all, I'm trying to optimise a controller action in my app (a product search) and the debug toolbar timeline isn't adding up properly at all - please see this screenshot: http://www.bovey.co.uk/debugkit.png The total request time is 7152ms but none of my actions or views account for this, as if some phantom code is at work. Equally the peak memory usage is way higher than the breakdown below it shows. Any ideas where this may be coming from? This is v1.2.7. Thanks all, Alex -- 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
DebugKit Toolbar timeline isn't adding up
Hi all, I'm trying to optimise a controller action in my app (a product search) and the debug toolbar timeline isn't adding up properly at all - please see this screenshot: http://www.bovey.co.uk/debugkit.png The total request time is 7152ms but none of my actions or views account for this, as if some phantom code is at work. Equally the peak memory usage is way higher than the breakdown below it shows. Any ideas where this may be coming from? This is v1.2.7. Thanks all, Alex -- 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 -- 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
How use model on cake shell
Hi, i newbie on cakephp. I want to develop a shell aplication, but when i try to use model no error shows and application don't execute. My code out('First line to show'); $results = $this->Pais->find('all'); $this->out('End execution'); } } ?> I try to use App:import('Model','Pais'); with the same result. Model 'Pais' is ok, and works on webpage. If i delete 'var $uses = array('Pais');' and '$results = $this->Pais- >find('all');', program execute ok. I'm mad trying to execute shell program and uses model. Someone can help me?. Thanks for all and sorry for my bad english. -- 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: Memory Leak in Model::Save()
On 4/8/2011 3:18 PM, ProFire wrote: Is there a way to clear the memory? Does anybody also experience a somewhat similar issue? where by each Model::Save results in an increase of memory? You can't control memory in PHP. I'd try different combos of max_execution_time[1] and memory_limit[2]. However I don't think this will help you much with the huge data sets you've mentioned. Another approach will be to split you data into blocks of n size and save it using Model::saveAll($data). HTH. [1] http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time [2] http://www.php.net/manual/en/ini.core.php#ini.memory-limit P.S. Providing a DB schema and some code would help everyone to better understand your situation. -- 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: Memory Leak in Model::Save()
On 4/8/2011 7:47 AM, keymaster wrote: I think Miles is pointing out there is a bug in php interpreter which can lose memory under certain circumstances, and through our coding we can trigger that bug. So, yes, it appears possible that memory can leak, and that by changing our code, we can stop it. Pretty scary, isn't it. Yeah, this can get nasty :-) -- 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: Memory Leak in Model::Save()
On 4/7/2011 8:37 PM, Miles J wrote: @Alex - Yes you can have memory leaks in PHP. http://www.google.com/search?q=memory+leaks+in+php&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a Miles, please point me to calloc/malloc PHP equivalent so I can test memory leaking in 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: Memory Leak in Model::Save()
On 4/4/2011 6:38 PM, ProFire wrote: I was very careful not to have any memory leak. You don't control memory in PHP, you can't have memory leaks. http://goo.gl/nm6OZ -- 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: Changing Model Conditions in another controller
On 2/24/2011 10:40 AM, heohni wrote: When I call $members = $this->Member->find('all'); Cake performs 2 statements. 1. to get all member results 2. to get all subscription results Use the Containable behavior and pass conditions to the related model. http://book.cakephp.org/view/1323/Containable#Containing-deeper-associations-1325 -- 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 relation problem
On 2/24/2011 6:54 PM, pang wrote: The problem is `Friend`.`friend_id` is left joined with `Friend`.`id`. How to solve this problem ? Give it a different alias. E.g.: public $belongsTo = array( 'MyFriend' => array('className' => 'Friend', 'foreignKey' => 'friend_id', ) ); -- 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: Cakephp 1.3 and Firebird
On 1/26/2011 11:43 PM, rc wrote: Hi Can you tell me where I can find dbo_firebird.php for Cake 1.3. The driver is mentioned in config/database.php, but the file isn't in the distribution. https://github.com/cakephp/datasources/blob/master/models/datasources/dbo/dbo_firebird.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: Join Tables between db
On 1/26/2011 3:08 AM, Dave Maharaj wrote: I have a site with 2 databases (same server) 1.Being resources_db (data that never changes, Country, States, various selects and options to select from throughout the site) 2.default_db users, profiles, things that can be changed, edited by users. Now join tables happen to cross between resources_db and default_db where does the join tables go in these situations? How do you tell Cake where to look? Hi Dave, I use something similar in one of my apps. Here are some snippets from my code, slightly adapted to your example. app/config/database.php class DATABASE_CONFIG { var $default = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'host', 'login' => 'user', 'password' => 'pass', 'database' => 'default_db', 'prefix' => '', ); var $resource = array( 'driver' => 'mysql', 'persistent' => false, 'host' => 'host', 'login' => 'user', 'password' => 'pass', 'database' => 'resources_db', 'prefix' => '', ); } app/models/user.php class User extends AppModel { .. public $belongsTo = array( 'Country' => array( 'className' => 'Country', 'foreignKey' => 'country_id', ), ); } app/models/country.php class Country extends AppModel { public $useDbConfig = 'resource'; public $hasMany = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'country_id', ) ); } With this setup I can do something like: $this->User->find('random', array('contain' => array('Country'), 'limit' => 10)); HTH -- 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: Get Random Articles.
max = select max(field) from table select * from table WHERE field>= ${rand(1, max)} ORDER BY field ASC LIMIT 1 OR select * from table ORDER BY (field>= ${rand(1, max)}) DESC, field ASC LIMIT 1 If you're use case is more demanding/complex than that here's a behavior which does the above using a field named "random" and even allows you to paginate 'random' data: https://github.com/AD7six/mi/blob/master/models/behaviors/random.php Thanks for the tip, AD. 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: Fck editor in cake php... Help needed
On 1/6/2011 3:16 PM, Test_deepak wrote: I cannot add fck editor to cake php. while i am adding to it some warning messages are given in my page. please help me. Here you go! http://goo.gl/840jo 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: Get Random Articles.
On 1/6/2011 9:26 PM, Nicolas400 wrote: Hi, I want a function that return me a Random Article from my Model. I guess all I need is the Find Method, but how do I know how this random number will match an existing ID ?? I'm really stuck. because if I had 3 articles (1,2,3) i want to get a random Id within those numbers, but if I have 10 articles is diferent.!! Why don't you try something like: $this->Model->find('first', array('order' => 'RAND()')); 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 loginAction and multiple prefixes
On 12/3/2010 2:41 PM, Jeremy Burns | Class Outfit wrote: Yup - I know, but I have multiple prefixes; so if I am diverted from, say, /managers/shops/edit I would need to have 'managers' => false (and therefore the 'admin' => false is irrelevant). In my core I have: Configure::write('Routing.prefixes', array('admin', 'user')); and in my beforeFilter: $this->Auth->loginAction = array('user' => false, 'admin' => false,'controller' => 'users','action' => 'login',); /user/articles/index properly redirects to /users/login if user is not logged in. I'm using 1.3.5 btw. 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 loginAction and multiple prefixes
On 12/3/2010 2:18 PM, Jeremy Burns | Class Outfit wrote: I did consider that, but I'm looking for something fairly simple to both implement and administer (I don't want to have to make loads of changes/create new objects when I add a new prefix, for example). Example from manual seems to do the trick[1]. Setting admin to false redirects to action without prefix. [1] http://book.cakephp.org/view/391/loginAction 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 loginAction and multiple prefixes
On 12/3/2010 1:46 PM, Jeremy Burns wrote: Not sure I've seen a definitive answer for this... I'm on 1.3.6, and have multiple prefixes. I want to always redirect to /users/login when authentication is required. I was hoping this would work: Have you considered teknoid's method [1]? The downside is that you'll have to create actions for all your prefixes. [1] http://nuts-and-bolts-of-cakephp.com/2009/01/12/462/ 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
Login from external service
Hi I'm new to CakePhp. So far it's been a great framework, but now I've run into a bit of a snag. The web app that we're working on has a client front end which is completely separate from cakePhp (Currently using the Qooxdoo library). The client and server comunicate using json and named parameters, and for the most part it works great. The only thing that I can't get working from the client is the login. I've tried to adapt what's shown in the tutorials, but I think that I don't understand Cake well enough yet. I'm trying to take the username and password from the URL, and send it to the Auth component. It fills what I send in to the fields, but it doesn't actually log me in. Thank you for your help Alex Here is what I have so far: Url: localhost/server/users/login/username:name/password:pass Controller: Auth->allow('*'); if(isSet($this->passedArgs['username'])) { $this->data['User']['username'] = $this->passedArgs['username']; } if(isSet($this->passedArgs['password'])) { $this->data['User']['password'] = $this->passedArgs['password']; } } function login(){ } function logout() { $this->redirect($this->Auth->logout()); } } View: Log in create('User',array('action'=>'login'));?> input('username');?> input('password', array('type'=>'password'));?> end('login');?> 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
How to identify functions causing apache CPU usage
Hi all, I've got a number of apache processes using a lot of CPU on my VPS. I've used lsof -p to see which files are open but I presume because it's CakePHP and therefore uses a dispatcher the only open dir I'm seeing is /home/%sitename%/public_html/app/webroot Any other tips for tracing what is running so slowly? Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 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: Admin interface templates / themes for CakePHP
On Thu, Sep 23, 2010 at 12:49 PM, Mike Karthauser wrote: > > I tend to build admin styles off the back of cake.generic.css which has > improved no end on the recent versions of cake 1.3.* > > i'm also using jquery ui themeroller styles for the rest of it as they are > pretty easy to integrate and useful depending on how much ajax you are > using. Thanks Mike - gone down the jQuery UI route also - cheers for that tip. Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 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
Admin interface templates / themes for CakePHP
Hi all, Has anyone used any nice admin interface templates with CakePHP? I'm trying to choose one from this list, but wondering whether anyone has done anything similar and done the necessary work to get the templates working nicely with Cake? http://www.ourtuts.com/34-outstanding-admin-panels-for-your-web-applications/ Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 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
Why are PHP notices still displayed when debug level is 0?
Hi all, I'm sure a few versions ago, PHP notices were never displayed when in production mode (debug 0) but now they are being shown. What's the best way of turning off notices when in production mode? Thanks all, Alex -- Alex Bovey Web Developer | Alex Bovey Consultancy Ltd Registered in England & Wales no. 6471391 | VAT no. 934 8959 65 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
Xampp from Apache friends
Hi, I am new to cake and I am running xampp from apache friends on a Windows vista pc. I am having trouble getting it to run though. The home page is missing image & the css is not working. I have read someplace that this is a .htaccess problem and else where taht it can be sorted by making changes to the apache http config files. Has anybody here had experience of & found a solution to this problem? 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
Re: contain param ignored
You probably just need to set the model to be containable. i.e. $this->ModelName->Behaviors->attach('Containable'); var $paginate = array( 'limit' => 10, 'page' => 1, 'order'=>array('Site.sort_order' => 'ASC'), 'fields' => array('*'), 'contain' => array( 'SiteIllustration' => array( 'fields' => array('id'), 'SiteIllustrationThumb' ) ) ); $result = $this->paginate('ModelName'); Let me know if this helps. On 22 July 2010 19:50, cricket wrote: > using 1.3.3 > > Site hasOne SiteIllustration > SiteIllustration belongsTo Site > SiteIllustration hasOne SiteIllustrationThumb > SiteIllustrationThumb belongsTo SiteIllustration > > In my SitesController, I'm calling paginate() to fetch my data. I want > the Site data, plus the SiteIllustrationThumb data. Without a > $paginate class var, I get the Site and SiteIllustration data, which > is expected. But, after adding: > > var $paginate = array( >'limit' => 10, >'page' => 1, >'order'=>array('Site.sort_order' => 'ASC'), >'fields' => array('*'), >'contain' => array( >'SiteIllustration' => array( >'fields' => array('id'), >'SiteIllustrationThumb' >) >) > ); > > ... the output remains the same. I do have $actsAs = > array('Containable') in AppModel. In fact, I can see the DB queries to > fetch the SiteIllustrationThumb data (and they work as expected from a > terminal). > > I know that I've run into trouble before with Containable and deep > associations but, AFAIK, that was resolved by ensuring that the id > field was specified for the "in between" models (SiteIllustration in > this case). > > Anyone got an idea what the issue is here? I have debug set to 2 and > caching is 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.comFor > 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!!
On Tue, Jul 13, 2010 at 12:24 PM, Mike Karthauser wrote: > refining by writing custom queries can be useful but having found an issue > recently where repeated custom queries were stealing memory and not being > cleared by garbage collection, i'd be a bit wary of this as a solution. > > if you do have issues with lots of queries, then you might also be worth > looking at view/ object caching if they are having performance issues on > your application. > > you'd also be worth moving up to a more recent version of cake1.2 as the > recent code releases are more optimised than the version you are using. > > mikek > > Cheers Mike - I will give that a go in the first instance - might even go to 1.3. Interesting what you say about custom queries. I definitely need to add some more caching but I thought there might be a quick fix reducing the number of queries first. Cheers, 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
Re: Too many SQL queries!!
Well, my debug level is 0 for production but since I can't see the SQL log I'm turning it to 2 for debugging. Can I get cake to log the SQL somewhere and still set debug to 0? Interestingly I found this, which seems to imply that Containable is the cause of the problem, rather than the solution: http://www.endyourif.com/cakephp-containable-statement-pitfalls/ Indeed if I stop using containable and instead set recursive to 0 or 1, I get fewer queries. Hmm, maybe it's time to start writing custom queries? On Tue, Jul 13, 2010 at 10:58 AM, Jeremy Burns | Class Outfit < jeremybu...@classoutfit.com> wrote: > 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 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 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.comFor >> 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.comFor > 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
Re: Too many SQL queries!!
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 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 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.comFor > 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
Too many SQL queries!!
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
Error with Jshelper in Simpletest test case
I'm writing a Simpletest test case for a helper class that uses Js helper, which has the value method for turning arbitrary PHP objects into JSON. I've done the setup: import the Js helper and construct it before using it. This is the error I'm getting: Fatal error: Call to a member function value() on a non-object in /var/ www/atsui/meep/cake/libs/view/helpers/js.php on line 182 Here's the source code for my test case: App::import('Helper', 'Js'); App::import('Helper', 'Googlemap'); class GooglemapHelperTestCase extends CakeTestCase { function startTest() { $this->Googlemap = new GooglemapHelper(); $this->Js = new JsHelper(); } function testJs() { $testArray = array( 'border' => '1px solid black', 'padding' => '5px', 'float' => 'left', 'clear' => 'both', ); debug($this->Js->value($testArray)); } function endTest() { unset($this->Googlemap); unset($this->Js); ClassRegistry::flush(); } } The intention is to test my helper (Googlemap above), which uses the Js helper, and the same error will appear if I just test a method in my helper that uses $this->Js->value. I wonder what I'm missing in this setup? 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
Email Component - Double Send
Hi, I have used this component with this following snippet code: foreach( $list as $mail ){ $this->Email->subject = 'HermesList'; $this->Email->replyTo = 'i...@alex.it'; $this->Email->from = 'Alex '; $this->Email->to = $mail['mails']['mail']; $this->Email->delivery = 'smtp'; $this->Email->template = 'email/html/Template/template'; $this->Email->sendAs = 'html'; $this->set('titolo', $data['Content']['titolo']); $this->set('descrizione', $data['Content']['descrizione']); $this->set('mail', $mail['mails']['mail']); $this->set('image', $data['Content']['link']); $this->Email->send(); $this->Email->reset(); } It works fine but some emails are sent twice!!! 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
Re: Release: CakePHP 1.3.1
According to this: http://cakephp.lighthouseapp.com/projects/42648/tickets/769-unserialize-error-cakephp-131-unusable-on-windows You have to edit file.php in order to fix it (which in not desirable too) On 30 Μάϊος, 14:41, Elte Hupkes wrote: > I get the exact same unserialize errors on a project previously > running fine on Cake 1.3 after updating to 1.3.1. Disabling cache > makes the error go away, but that's not really desirable of course.. > > On 30 mei, 02:48, Sergei wrote: > > > Hi, > > > just tried 1.3.1 with one of my project (Cake 1.3). It instantly gave > > me an errors on almost *every* page (see below). Removing TMP\cache > > \persistent\ files doesn't help. > > > = > > Notice (8): unserialize() [function.unserialize]: Error at offset 0 of > > 1661 bytes [CORE\cake\libs\cache\file.php, line 176] > > Code | Context > > $key = "cake_core_file_map" > > $time = 1275179913 > > $cachetime = 1275179919 > > $data = "" > > unserialize - [internal], line ?? > > FileEngine::read() - CORE\cake\libs\cache\file.php, line 176 > > Cache::read() - CORE\cake\libs\cache.php, line 347 > > App::getInstance() - CORE\cake\libs\configure.php, line 967 > > App::build() - CORE\cake\libs\configure.php, line 650 > > Configure::__loadBootstrap() - CORE\cake\libs\configure.php, line 431 > > Configure::getInstance() - CORE\cake\libs\configure.php, line 52 > > include - CORE\cake\bootstrap.php, line 38 > > [main] - APP\webroot\index.php, line 77 > > > Notice (8): unserialize() [function.unserialize]: Error at offset 0 of > > 28 bytes [CORE\cake\libs\cache\file.php, line 176] > > Notice (8): unserialize() [function.unserialize]: Error at offset 0 of > > 5 bytes [CORE\cake\libs\cache\file.php, line 176] > > Notice (8): unserialize() [function.unserialize]: Error at offset 0 of > > 105 bytes [CORE\cake\libs\cache\file.php, line 176] > > == > > > On May 30, 2:29 am, mark_story wrote: > > > > The CakePHP development team is happy to announce the release of > > > CakePHP 1.3.1[1]. 1.3.1 is the first maintenance release for 1.3 and > > > contains bugfixes and optimizations for features found in 1.3. No new > > > features will be introduced in the maintenance releases for 1.3. > > > Regular maintenance releases for 1.3 are planned on a monthly basis > > > for the near future. > > > > Since the release of CakePHP 1.3.0 last month, there have been more > > > than 70 commits and 45 tickets resolved. There have been a few changes > > > that may affect your application. > > > > - The conditional check around including custom session configuration > > > files was removed. This fixes issues where requestAction could cause > > > loss of session settings, and improves the end developers ability to > > > customize the session. Custom session files should ensure that > > > classes/functions are conditionally declared. > > > > - How virtualFields are detected and parsed was modified to allow > > > virtualFields on the same table. A virtualFieldSeparator property was > > > added to DboSource to allow customization of the virtualField > > > separator. If you have fields containing '__' you may have to modify > > > this setting to avoid issues. > > > > - EmailComponent had a number of changes made to better support ELHO > > > and slow SMTP servers. > > > > Be sure to check the full changelog[2] for all changes that have > > > occurred. We'd like to welcome Juan Basso[3] to the development team. > > > Juan has been very active in the brazilian community and we're really > > > happy to have him. Work on the 2.0 branch continues to progress. > > > Currently much of the effort is focused on getting our migration to > > > PHPUnit complete. We'd like to thank the ongoing community efforts > > > around the documentation. There are now over 18,500 revisions in the > > > cookbook and 4 languages now have more than 70% of the documentation > > > translated. > > > > As always, thank you for helping us make a great framework and > > > fantastic community. > > > > Download a packaged release [1] > > > View the changelog [2] > > > > [1]http://github.com/cakephp/cakephp/downloads > > > [2]http://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-1 > > > [3]http://blog.cakephp-brasil.org/ 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
WorldPay component
Hi all, Does anyone know of a WorldPay component available for CakePHP? All I've really found is bakepay which doesn't seem to be complete: http://cakeforge.org/projects/bakepay/ Thanks all, 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
Using a controller in a shell task
Hi guys, Can anyone help me out with this. I have a function that I use within say a messages controller, but I also want to call this from a cron shell task. I can get to it by doing various App::imports but then the model - >Behaviors->attach doesn't work. Can anyone provide a definitive solution to using a controller with all the helpers/models needed from within a shell task? Thanks 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 To unsubscribe, reply using "remove me" as the subject.
increase performance with often used queries
Hi people :) I've been working on my cakephp project for some time now and now i start to realize that I must be able to do something with the performance. I've read alot of tutorials and I will for sure use them later on but now I have a different concern. Lets say for example I have a Car model a car has a user, speed, name etc. Every user who is logged in has a certain car like User id 4 has car id 4 User id 5 has car id 5 You get the idea. Now what my problem: I have to use this 1 car belonging to the user in many different controllers. The result is I use something like $this->Car->findById(5); very often creating maybe 5-6 times the same query on 1 page! Is there a way to reduce this somehow? Like fetching the model data once and use it for all controllers or cache it somewhere for that 1 user? I really appreciate any help. Regards 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 To unsubscribe, reply using "remove me" as the subject.
Re: repeatedly call controller action through ajax
´I think I've got it to work by doing as you said with a few compromises here and there : ) Big thanks I really appreciate your help. Regards Alex On 24 Mrz., 11:29, John Andersen wrote: > Ok, if your page is loading normaly, then pass the information to the > view/layout and in there, make the decision to activate or not, the > ajax request to the bar action. > How you are going to do it is up to you, I have no idea :) of what > information you use and how you have chosen to implement your solution > to your web site! > Enjoy, > John > 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: repeatedly call controller action through ajax
Hi John, thanks for your answer could you explain a bit further how to retrieve the condition and return it with the result? I've worked with php a long time now but i just recently delved into ajax so I still have to find my way around. And btw my normal page loading works without ajax I only want a action which reacts to specified events (like a change in the database) to be executed over and over again and "do something" if that certain event happens. Regards Alex On 24 Mrz., 08:09, John Andersen wrote: > I am not sure how your page loading is working - with ajax or without > - so here is what I would do based on your information: > > In the first ajax call to the bar action, retrieve the dynamic > condition and return it together with the ajax result. Then act upon > it as you want. > > Enjoy, > John > 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
repeatedly call controller action through ajax
Hi guys, I'm having a problem with my project where I could freak out about. The situation is the following: I have a controller foo which has an action bar. Now the thing i want to get going: have the bar action running all the time while your on the page by a fixed interval with a condition if a certain entry is made in the database. I got it to work by using ajax and the remoteTimer method. But now I have the following problem: I can't figure out how I can have a "dynamic condition" like: Only run the ajax event if a certain field in database is set to 0 or 1 I know I can control the execution by the condition param and using a javascript If() (Like: 'condition' => '10 == 90' which will prevent it from running) in there but is it possible to populate this condition dynamically from the database or is there even a better way to handle this whole situation? Big thanks in advance. Regards 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Tips on performance monitoring / profiling
On Wed, Mar 17, 2010 at 7:43 PM, Jon Bennett wrote: > > Indexes make a huge difference, as does using the right column types. > Containable is great, but you still need to analyse what's being > retrieved and adjust. As little as possible generally! > >> Whilst there is the core cache library which is great, do you use any >> kind of component in front of this to abstract it? Or is it a case of >> manually checking whether the cached element exists in your controller >> action and then if not fetching from the DB? > > I have a custom solution based around Mile J's > http://www.milesj.me/blog/read/34/Cacheing-Each-Query-Individually. > It's pretty easy to cache stuff though, it's knowing when to clear > them out that's the tricky bit. Cheers JB - great help as always! -- 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Tips on performance monitoring / profiling
On Wed, Mar 17, 2010 at 6:09 PM, Christian Leskowsky wrote: > > You might want to give YSlow / Page Speed a try too. They often turn up an > area or 2 worth looking into. Thanks Christian - good advice too. -- 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 To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
Re: Tips on performance monitoring / profiling
On Wed, Mar 17, 2010 at 5:23 PM, Jon Bennett wrote: >> Has anyone got any tips on performance monitoring and profiling a cake app? > > In terms of profiling - it sounds like its the DB that's being > sluggish, how many hits are you getting? on what spec server? if you > have access you could run > http://www.webdevelopmentstuff.com/123/optimizing-mysql-performance-tuning-script.html > to try and optimise your mysql server. Always there with solid advice JB - ta! Yeah I think I'm just too lazy when it comes to indexes. Definitely using Containable, but should probably be making better use of caching. Whilst there is the core cache library which is great, do you use any kind of component in front of this to abstract it? Or is it a case of manually checking whether the cached element exists in your controller action and then if not fetching from the DB? -- 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
Tips on performance monitoring / profiling
Hi all, Has anyone got any tips on performance monitoring and profiling a cake app? I'm using containable and number of queries doesn't look too bad but it's all running pretty slowly at the moment. Thanks, Alex -- 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
Auto create new entry in database wenn model is saved
Hi folks, I recently started using cakephp for one of my projects and I already really like it, now I have a problem which I worked on for a while but couldnt solve it yet... Lets say I have a User model and a user has a related table like Car: User 1 -- 1 Car Now by using a Form I want to save the user and the car to the database but now comes my problem: Car also has relations to 3 other tables which must be also created when a new car is created for example: 1 Carmodel table User1 -- 1 Car -- 1Attribute table 1 Misc table Is there a way I can also create those 3 related tables for car when I save User and Car? Thanks in advance regards 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
Re: Loop Issue Cakephp
Yes I tried! it works!!... Thanks ! On 26 Gen, 18:05, John Andersen wrote: > Did you try to reset the email fields? > > I wanted to see that your index action didn't loop! > Enjoy, > John > > On Jan 26, 5:05 pm, alex wrote: > > > > > I notice that removing $this->flash(...) and writing only the code of > > redirecting $this->redirect('action'=>'index'); that pic isn't > > appeared again... > > > my index function is that standard : > > > function index() { > > $this->Content->recursive = 0; > > $this->set('contents', $this->paginate()); > > } > > > why ? > > > On 26 Gen, 15:53, John Andersen wrote: > > > > It is stated the CakePHP manual, that you have to reset the Email > > > fields using the reset method as specified in: > > > >http://book.cakephp.org/view/270/Class-Attributes-and-Variables#Sendi... > > > > Your final flash message invokes the action "index" in the current > > > controller. What is the content of that action? > > > Enjoy, > > > John > > > > On Jan 26, 3:34 pm, alex wrote: > > > > > Hi, I'm trying to develop a mailing list In the controller > > > > CONTENTS there's a function called sendMailingList > > > > [code] > > > > $list = $this->Content->query("SELECT * FROM mails > > > > WHERE sub = > > > > '1'"); > > > > $data = $this->Content->find($id); > > > > > $this->Email->smtpOptions = array( > > > > . > > > > ); > > > > > foreach($list as $info){ > > > > $this->Email->subject = 'Test'; > > > > $this->Email->replyTo = 'no-re...@.it; > > > > $this->Email->from = 'xxx '; > > > > > $this->Email->to = > > > > 'mailingl...@alexgenovese.it'; > > > > $this->Email->delivery = 'smtp'; > > > > $this->Email->template = 'html/default'; > > > > $this->Email->sendAs = 'html'; > > > > $this->Email->to = $info['mails']['mail']; > > > > $this->set('title', $data['Content']['titolo']); > > > > $this->set('content_for_layout', > > > > $data['Content']['descrizione']); > > > > $this->set('image', $data['Content']['link']); > > > > $this->set('mail', $this->Email->to); > > > > $this->Email->send(); > > > > } > > > > > $this->flash(__('Email sent', true), array > > > > ('action'=>'index')); > > > > [/code] > > > > > it works for one email ( without foreach($list as $info){...} ), but > > > > when i trying to send with this method I see this nex pic... > > > > >http://www.flickr.com/photos/davidale/4306633066/ > > > > > ...I wait your answers > > > > > Thanks a lot! > > > > 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
Re: Loop Issue Cakephp
I notice that removing $this->flash(...) and writing only the code of redirecting $this->redirect('action'=>'index'); that pic isn't appeared again... my index function is that standard : function index() { $this->Content->recursive = 0; $this->set('contents', $this->paginate()); } why ? On 26 Gen, 15:53, John Andersen wrote: > It is stated the CakePHP manual, that you have to reset the Email > fields using the reset method as specified in: > > http://book.cakephp.org/view/270/Class-Attributes-and-Variables#Sendi... > > Your final flash message invokes the action "index" in the current > controller. What is the content of that action? > Enjoy, > John > > On Jan 26, 3:34 pm, alex wrote: > > > > > Hi, I'm trying to develop a mailing list In the controller > > CONTENTS there's a function called sendMailingList > > [code] > > $list = $this->Content->query("SELECT * FROM mails WHERE > > sub = > > '1'"); > > $data = $this->Content->find($id); > > > $this->Email->smtpOptions = array( > > . > > ); > > > foreach($list as $info){ > > $this->Email->subject = 'Test'; > > $this->Email->replyTo = 'no-re...@.it; > > $this->Email->from = 'xxx '; > > > $this->Email->to = 'mailingl...@alexgenovese.it'; > > $this->Email->delivery = 'smtp'; > > $this->Email->template = 'html/default'; > > $this->Email->sendAs = 'html'; > > $this->Email->to = $info['mails']['mail']; > > $this->set('title', $data['Content']['titolo']); > > $this->set('content_for_layout', > > $data['Content']['descrizione']); > > $this->set('image', $data['Content']['link']); > > $this->set('mail', $this->Email->to); > > $this->Email->send(); > > } > > > $this->flash(__('Email sent', true), array > > ('action'=>'index')); > > [/code] > > > it works for one email ( without foreach($list as $info){...} ), but > > when i trying to send with this method I see this nex pic... > > >http://www.flickr.com/photos/davidale/4306633066/ > > > ...I wait your answers > > > Thanks a lot! > > 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
Loop Issue Cakephp
Hi, I'm trying to develop a mailing list In the controller CONTENTS there's a function called sendMailingList [code] $list = $this->Content->query("SELECT * FROM mails WHERE sub = '1'"); $data = $this->Content->find($id); $this->Email->smtpOptions = array( . ); foreach($list as $info){ $this->Email->subject = 'Test'; $this->Email->replyTo = 'no-re...@.it; $this->Email->from = 'xxx '; $this->Email->to = 'mailingl...@alexgenovese.it'; $this->Email->delivery = 'smtp'; $this->Email->template = 'html/default'; $this->Email->sendAs = 'html'; $this->Email->to = $info['mails']['mail']; $this->set('title', $data['Content']['titolo']); $this->set('content_for_layout', $data['Content']['descrizione']); $this->set('image', $data['Content']['link']); $this->set('mail', $this->Email->to); $this->Email->send(); } $this->flash(__('Email sent', true), array ('action'=>'index')); [/code] it works for one email ( without foreach($list as $info){...} ), but when i trying to send with this method I see this nex pic... http://www.flickr.com/photos/davidale/4306633066/ ...I wait your answers Thanks a lot! 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
Multiple Email with Cakephp component
Hi... I have an issue about multiple send...my view call a function called simplesendmail: [code] function sendSimpleMail($id = null) { $list = $this->Content->query("SELECT * FROM mails WHERE sub = '1'"); $data = $this->Content->find($id); /* SMTP Options */ $this->Email->smtpOptions = array( . ); foreach($list as $info){ $this->Email->to = $info['mails']['mail']; } $this->Email->subject = 'Test - Mailing List'; $this->Email->replyTo = 'Test@ Test.org'; $this->Email->from = 'Test < Test@ Test.it>'; /* Set delivery method */ $this->Email->delivery = 'smtp'; $this->Email->template = 'html/default'; $this->Email->sendAs = 'html'; $this->set('title', $data['Content']['titolo']); $this->set('content_for_layout', $data['Content']['descrizione']); $this->set('image', $data['Content']['link']); if ( $this->Email->send() ) { $this->Session->setFlash('Simple email sent'); } else { $this->Session->setFlash('Simple email not sent'); } $this->redirect(array('action'=>'index')); } [/code] it works for a single send i modified the simple send adding the follow code: [code] foreach($list as $info){ $this->Email->to = $info['mails']['mail']; } [/code] where $info is an array of emails... how can i add multiple recipients for a multiple send ? 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
controller problem
layout = "club_free_text_layout"; } } ?> $Route->connect('/free_text',array('controller'=> 'freetext','action' => 'index')); please can anyone tell me why when i visit the /free_text i get Not found The requested address index was not found on this server. and when i visit free_text/index 123 Not found The requested address index was not found on this server. did I do something wrong? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Preserving get variables using paginator
Perfect! Thanks! On 19 Οκτ, 15:53, grigri wrote: > Add this to the top of the relevant view: > > $q = $_GET; unset($q['url']); > if (!empty($q)) { > $paginator->options(array('url'=>array('?' => $q))); > } > > On Oct 19, 12:32 pm, Alex Seim wrote: > > > I would like to know if there is a way to preserve variables passed > > via form type='get' along with using the pagination. Currently, using > > the pagination helper, when sorting/browsing, get variables disappear. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Preserving get variables using paginator
I would like to know if there is a way to preserve variables passed via form type='get' along with using the pagination. Currently, using the pagination helper, when sorting/browsing, get variables disappear. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 var $scaffold redirect
I've got it working by overwriting the scaffold controller in the cake library with the controller from version 1.2.4. I did a diff on the two files and I noticed that the main difference is the use of $_validSession in the newer file. I'm new to CakePHP (this is my first project), so I don't know if what I did is heresy, but it seems to work. Maybe we should submit a bug for version 1.3? On Aug 31, 5:09 am, Andras Kende wrote: > Hello, > > is it possible that in cake 1.3 using var $scaffoldwontredirecton > save or edit ? > I just get a blank page. > > class ProductsController extends AppController { > var $scaffold;} > > ?> > > core.php set to: > Configure::write('debug', 0); > > Thanks, > > Andras --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 var $scaffold redirect
I'm having the same issue. I hope to solve it today; if I do, I'll post here. On Aug 31, 5:09 am, Andras Kende wrote: > Hello, > > is it possible that in cake 1.3 using var $scaffoldwont redirect on > save or edit ? > I just get a blank page. > > class ProductsController extends AppController { > var $scaffold;} > > ?> > > core.php set to: > Configure::write('debug', 0); > > Thanks, > > Andras --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: base path route don't work
I have the same problem. I'm not very familiar with mod_rewrite, cake or apache in general so it's a bit hard to figure out. I can access my website at http://localhost/site1/ but can't find how to change settings to http://localhost. When I open http://localhost it shows an empty page instead of index.php page as in http://localhost/site1. DocumentRoot directory in apache is set according to Cake install doc and other params as well. Please advise --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
MVC Design Question
Hi, I am building a small cake application to learn MVC and cakePHP. I have a question about where to put business logic, I have read that controls should be skinny and models should be fat. Eg the business rules should live in the models. In my application I have the following models User, Portfolio, Currency. A user has 1 portfolio which has 1 currency. When I register a user I would like to create their portfolio and assign it the default currency. My question is where to do the creation of the portfolio? (Fat Controller) 1. Call the User model to create a new user. 2. Call the Currency model to get the default currency. 3. Call the Portfolio model to create a new portfolio for the new user with the default currency. Or (Fat Model) 1. The controller calls a custom function on the Users model. Eg registerUser($formData) 2. The User model validates and saves the new user. 3. The user model then calls the Portfolio model to create a new portfolio for the new user. 4. The Portfolio model calls the Currency model to get the default currency and creates the new portfolio for the new user. The advantage I can see to the Fat Model way is that the logic for registering a new user is all in one spot. So if I have many controllers that need to register a new user I can just use the same code. Is this on the right track? Thanks, Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: Debug Comment Data in JSON Results
Ahh, I see. Didn't think to write the debug configuration based on the request. Annoying though that it appends that right? What practical purpose could it serve? Thank you, Alex On Mar 3, 11:57 am, bcreeve wrote: > What I do is parse .json extensions and return the JSON with > Configure::write('debug', 0); like brian stated. > > If I want to see what errors I'm getting when things bomb, I can hit > the same URL without the extension to return the data as HTML in the > default layout while respecting the environment's debug mode. > > On Mar 3, 2:43 pm, brian wrote: > > > On Tue, Mar 3, 2009 at 2:09 PM, Alex wrote: > > > > I'm using the javascript->object() method to return JSON data for XHR > > > requests. All works great when the cake debug level is set to 0, but > > > when higher will append an html style comment to my JSON data like so: > > > "", indicating the response time of the request. This > > > prohibits the JSON data from being evaluated. Is there anyway to keep > > > a non-zero debug level and keep cake from appending this value? > > > Do you mean, so that you can see debugging info aside from the XHR request? > > > Configure::write('debug', 0); > > > ... just before you send the JSON data. This way, you can see > > debugging info elsewhere. There's no practical way to output debugging > > info *with* your JSON data, as you've already seen. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Debug Comment Data in JSON Results
I'm using the javascript->object() method to return JSON data for XHR requests. All works great when the cake debug level is set to 0, but when higher will append an html style comment to my JSON data like so: "", indicating the response time of the request. This prohibits the JSON data from being evaluated. Is there anyway to keep a non-zero debug level and keep cake from appending this value? Thanks, - Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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: FileMaker database "driver"
Hi bdb, I'm highly interested in your work in this area. I was just thinking of starting this project myself. Can you tell me if you've made any progress since April 2006? - Alex On Jan 13, 12:10 am, Louie Miranda wrote: > Hi! Very interested. Where could we see the component for FX.php to be > able to integrate cakephp+fm. > I am also wondering if FX.php will ever work for FM 9 and 10. > > Louie > > On Apr 12 2006, 7:48 pm, "bdb" wrote: > > > I have hacked together a version of The Cake Blog Tutorial from > > manual.cakephp.org that uses a FileMakerdatabasefor data storage and > > retrieval. Currently it is very specific to the tutorial example, but > > I am working on making the functions generic so they can be applied to > > other projects I have going. > > > I am utilizing FX,php (www.iviking.org) which I placed in the vendors > > folder and then created a dbo_fmpro.php file in cake/libs/model/dbo/ > > that defines a class called DboFmpro. Since FileMaker does not use > > SQL, the DboFmpro class DOES NOT extend DboSource, so I have had to > > recreate much of the functionality that is typically inherited from > > dbo_sourse.php, datasource.php, and model_php5.php into either > > dbo_fmpro.php or app_model.php. The app/config/database.php file has a > > 'driver' value of 'fmpro' and contains the parameters that are usually > > found in the server_data.php file under FX. > > > At this point I am curious to know if there's anyone else out there > > that would be interested in this project. I'm very comfortable with > > the concepts of OOP and "objectify" my FileMaker scripts as much as > > possible, but I am currently hacking my way through this with a big, > > ugly machete -- using it as a OOPHP learning process while creating a > > framework for various FileMaker-hosted web sites that I have designed. > > The Cake Blog Tutorial uses exactly the same code as the manual > > provides so you can easily switch back and forth between the > > mysql-based system and the fmpro-based system by simply > > changingdatabase.php and removing (or just renaming) app_model.php -- which > > was > > my ultimate design goal from the outset. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the 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 -~--~~~~--~~--~--~---
Strange problem with App:Import of controller class
I have two controller classes: class PagesController extends AppController { (...) function home() { App::import('Controller', 'NewsPosts'); $controller = new NewsPostsController(); $this->set('NewsGrouped', $controller->_getNewsGrouped()); } (...) } and class NewsPostsController extends AppController { var $name = 'NewsPosts'; var $uses = array('NewsPost', 'NewsType'); (...) function index(){ $this->set('NewsGrouped', $this->_getNewsGrouped()); } function _getNewsGrouped(){ $types = $this->NewsType->find('all', array('conditions' => array('max_num >' => 0), 'order' => 'NewsType.order')); (...) } (...) } When I call http://mysite/news_posts/index, everything works fine, but when I call http://mysite, that is mapped to PagesController::home action, I get an error: Fatal error: Call to a member function find() on a non-object in Z:\home\test1.ru\www\app\controllers\news_posts_controller.php on line 24 I can't really understand that, since I use the same scheme in several other places and it works fine everytime. What could be the problem?? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Reporting solution for CakePHP
Hello, I would like to know if anyone has any reporting solution to suggest that works well with cake (like Crystal Reports or something) thanx --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Findall on a belong b belong c.name='fred'
Have you found a clear answer about this? On 18 Απρ, 04:08, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I have 3 models: > A belongs to B > B belongs to C > > I want tofindAllA where C.name='fred'. > > I had assumed that cake would justleft jointhe 3 tables and c.name > would be accessible in the query. But regardless of what level of > recursive I set, it only left joins A and B and then does > multitudinous other queries to get C. Hence I can't refer to c.name in > the query. > > I've searched and read lots of messages and trac item that implies > that Cake is doing what it thinks is correct. > > If so, what is the recommended way of doing this query? > > Do the new 'bindable'/'container' behaviours (which should be used?) > help with this? > > Thanks > Peter --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
session reset issues
I have been trying to get session to not reset going from one controller action to another via a link, but it seems pretty difficult to try and troubleshoot. I am using cakephp 1.1. I turned all of the security settings I could find to low. It still seems to break though. I am guessing that there is a server setting run amuck. When I try to apply configurations to php via .htaccess I get a nifty internal error. This is all using a machighway.com account. (Not my choice at all.) What are the possible reasons for this? This was all working fine from my testbox running XP and XAMP. Also what are some inexpensive isp's with cakephp friendly settings? -Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Saving NOW() in model
Zifnab wrote: > I'm trying to figure out how to implicitly make a mysql NOW() call > when doing a model save...here's an example of the code: > > $aUserData = array( > 'User' => array( > 'id' => 4, > 'last_login' => 'NOW()' > ) > ); > > $this->User->save( $aUserData, false, array( 'last_login' ) ); > > > Naturally the save doesn't work, because NOW() saves as a string > "NOW()" instead of as a mysql function NOW()How do I get it to > save as a mysql function? > > $aUserData['User']['last_login'] = date("Y-m-d H:i:s"); $this->User->save($aUserData); Not using NOW(), but does the trick. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to handle request not connected to a model ?
Hi everyone, I'm new to CakePHP and find this set of tools very useful. I understand how to build an app when it's drived by a MVC approach (model, views, controlers created with the Console, w/i or w/o scaffholding or the default CRUD methods). But I'm a bit confused when it deals with handling request not related to a model, or related to several models. For instance: 1/ Having a generic home page, leading to different pages and models (users profile, content admin) 2/ Having a stats module which displays (on one or several pages) statistics on data stored on several and unrelated model My idea, based on a non-MVC driven experience, will have to build a generic controler that will forward requests to different methods, depending on the parameters passed to the URI, ie something like "page.php?page=statistics&action=view&item=users" but applied to CakePHP. The problem is that I'm not sure it is correct, or in accordance with the CakePHP /MVC philiosophy. Have you already met this kind of problems ? How have you solved it ? Is there any white book or best practices concerning this ? Thanks for your help, Alex Devry 8) --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Sorting related object according to their related objects
Hi folks, I have a model like the following: Article hasMany Comment Comment hasOne User Now I want to fetch all comments from one article limited by ten. These ten should be the comments with the most popular users (User.popular). Is it possible to define the "Article hasMany Comment" relationship with a limit and an order by his sub-object "User.popular"? Bye, ALex --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
GoogleBot gets a 404 on site with out index.php
Hi, I have a strange issue where I have installed cakePHP and it looks like it works fine. If I browse to http://AlexJeffery.org/ I see what I would expect. How ever googlesite maps says it gets a 404 on http://AlexJeffery.org/ I have tried several spiders to generate a sitemap and they all get a 404 on http://AlexJeffery.org/ If I point them to http://AlexJeffery.org/index.php they can find that and spider correctly. I tried adding the following line to the .htaccess in the app/webroot DirectoryIndex index.php But it still gets a 404 Any ideas on how to fix this? I would like my sitemap to work :) Thanks, Alex --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: How to make session expire after browser close?
On 4 Jul., 11:57, SMARTEGURU <[EMAIL PROTECTED]> wrote: > define('CAKE_SESSION_SAVE', 'database'); > define('CAKE_SECURITY','low'); > define('CAKE_SESSION_TIMEOUT', '12'); CAKE_SECURITY = low causes the session cookie to be saved for 78894 seconds - even if your browser is being closed, the cookie session is saved. also CAKE_SECURITY = low multiplies CAKE_SESSION_TIMEOUT by 300. Just wait 3600 seconds and look what's happening ;-) You have to put CAKE_SECURITY to 'high' which results in not saving the session into a cookie, but then you have to set CAKE_SESSION_TIMEOUT to a higer value (CAKE_SECURITY = high multiplies CAKE_SESSION_TIMEOUT by 10 resulting an active session for 120 seconds) --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Performance Time (debug variable)
Hi, Is it possible to replan the concept of the debug-variable? I need to hide the performance time which is printed (index.php) as a html-comment at the end of each view. The ajax-inplaceeditor handles this comment as a value. what i need is to run in debug=1 mode and to hide the performance time separately. Greetings, Alex --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: HTML-considering Truncate()-Function
I submitted this function also as a possible enhancement of the default truncate function in the TextHelper. I also wrote a test case for this function https://trac.cakephp.org/ticket/2306 --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: Email Component and UTF8 Subject
I opened a ticket for this topic: https://trac.cakephp.org/ticket/2298#preview --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Spam-protected, accessible forms?
Hi, Since my site was attacked by spammers, I was working on a solution, that generates some random input boxes inside my formula. when these (hidden by several methods) were filled by an automated spam-robot, the following action will not take place. the other inputs had to be randomly renamed. the posted data would be mapped to get the original inputs-name (saved via session). this solution prevents spam robots from searching the whole web page for input fields containing "text", "homepage" or "name/username" and filling it and does not use captchas (better accessibility). but my solution required many heavy changes in the html and form helper. so has anybody got an idea, how to implement this into cake without making the application unupdateable? in general my helper have to change the html-code returned by the form helper. the controller offers a function which maps the posted data back. Greetings, Alex --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: HTML-considering Truncate()-Function
Hi gwoo, Cool to hear. Do you mean I should submit the whole function to trac.cakephp.org to suggest it for 1.2 or should the users submit bugs in this function there? I don't know how the process for this works :-) Thanks, Alex --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---
Re: HTML-considering Truncate()-Function
I added this solution to CakeForge: http://cakeforge.org/snippet/detail.php?type=snippet&id=174 --~--~-~--~~~---~--~~ 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?hl=en -~--~~~~--~~--~--~---