Re: Ajax & Uploads with Cake
Theres no such thing as AJAX uploading. However you can mimic it, like Shadab said. I prefer http://valums.com/ajax-upload/ which is supported with jQuery. On Oct 29, 10:21 pm, Shadab Shaikh wrote: > Hi Will, > > Basically in sites, to achieve ajax uploading effect,iframe functionality > has been used. It's not pure we can say that Ajax upload. > > I have used one good jQuery plug-ins,http://www.uploadify.com/demo/ > > Here Ajax like functionality and flash support. Due to flash support, you > can also upload multiple files with file uploading progress bar. > > Hope that it will help to you. > > Best Regards, > Shadab > > On Fri, Oct 30, 2009 at 9:41 AM, Will Poillion wrote: > > > Does anyone have a link to a tutorial explaining how to do uploads > > using ajax? > > > One that includes JQuery would be even better, and pertaining to cake, > > to a lesser degree, but mainly I need to learn how to do file uploads > > using ajax, and hopefully avoid some common pitfalls along the way. > > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: time duration
And this may also be of use: http://book.cakephp.org/view/189/Automagic-Form-Elements#options-interval-757 On Oct 30, 8:00 am, Jiru wrote: > Hi, > I have a time field in the form. In the combo box it have > meridians[am/pm]. > As I want duration I need hh/mm instead of am/pm in the drop > down.Please give suggessions for this. > Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: time duration
Please read the cook book! http://book.cakephp.org/view/189/Automagic-Form-Elements#options-timeFormat-202 Enjoy, John On Oct 30, 8:00 am, Jiru wrote: > Hi, > I have a time field in the form. In the combo box it have > meridians[am/pm]. > As I want duration I need hh/mm instead of am/pm in the drop > down.Please give suggessions for this. > Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
404 Status
Hi, My installation of cake returns a 200 status for missing items, eg controller not found, action not found etc etc. Am i right in thinking this is a bit of a no-no seo wise? I thought google likes to see a 404 code for 404 pages. Also, it makes it hard to look in firebug and see what files are missing (am i incuding jquery correctly etc) because everything is 200 ok, not 404 and red. If i open in anouther tab, i get the helpfull cake page prompting me to create a controller. Is this normal cake behaviour? how can i change it? Should cake not do this? Thanks Will --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
time duration
Hi, I have a time field in the form. In the combo box it have meridians[am/pm]. As I want duration I need hh/mm instead of am/pm in the drop down.Please give suggessions for this. Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: "null" response on Ajax request
To avoid such problems I set debug to 0 at the very end of AJAX view/ layout. So If there are errors - I see them and can fix, if there are no errors - response is clear of debug data. On Oct 29, 5:55 pm, Thanos Atskakanis wrote: > it was set to 2 but AjaxHandler component was setting it back to 0 - > disabled it and found out that the problem was coming from a missing file in > the live server - rookie error :o) > > thanks a lot for that > > > > On Thu, Oct 29, 2009 at 4:04 AM, Dr. Loboto wrote: > > > Set debug to at least 1 (and no matter that it is ajax) to see error. > > > On Oct 28, 10:34 pm, Thanos Atskakanis > > wrote: > > > Hi all, > > > > I am currently building a CMS and my system does some ajax requests which > > > return some html: simple and nice. > > > When I run it locally it all works fine but when I put it live instead of > > > the expected html I get "null". Not "Not found" or any other error, just > > the > > > word "null". > > > > All I use is the RequestHandler component and the following line of code: > > > $this->render('/path/to/element'); > > > I also use milesjohnson's AjaxHandler component somewhere else in my > > > controller, but it doesn't seem to be the problem because I tested > > without > > > it and everything was fine... > > > > Here are the response headers I get in both servers: > > > > Live ("null" response): > > > > DateWed, 28 Oct 2009 16:08:26 > > GMTServerApacheX-Powered-ByPHP/5.2.11P3PCP="NOI > > > ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"Set-CookieCAKEPHP=deleted; > > > expires=Tue, 28-Oct-2008 16:08:26 GMT; path=/ > > > CAKEPHP=0svbs500eu74f9613mjd02sn71; > > > path=/Content-Length4ConnectioncloseContent-Typetext/html; charset=UTF-8 > > > > Locally (normal html response): > > > > DateWed, 28 Oct 2009 16:08:35 GMTServerApache/2.2.12 (Ubuntu)X-Powered-By > > > PHP/5.2.10-2ubuntu4P3PCP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" > > > Set-CookieCAKEPHP=deleted; expires=Tue, 28-Oct-2008 16:08:35 GMT; > > > path=/johnross CAKEPHP=c37700dbbbf3d009cfa920695637118a; path=/mypathVary > > > Accept-EncodingContent-EncodinggzipContent-Length50Keep-Alivetimeout=15, > > > max=87ConnectionKeep-AliveContent-Typetext/html; charset=UTF-8 > > > > Anyone who came across a similar situation? > > > > Thanks, > > > Thanos --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Cake Hosting - Who is the best?
I know this isn't a cake question but I respect the cake community more than anybody so I wanted to ask you guys. I was using a VPS at hostmysite for $36 a month. It was nice because it was cheap, linux based, speedy and allowed me to do what I needed to do like up the php memory limits for resizing images and such. SHared hosting usually is too darn restrictive... especially is you want to install a plugin or something. Unfortunately they got rid of that server option and replaced it with one that is five times the price. So I am once again looking for good hosting that is inexpensive and doesn't have all the limitations and frustrations that come with shared hosting. Who do you guys use? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
RequireSecure Redirect Issues
I put the following code in one of my controllers, trying to force it to use SSL: function beforeFilter() { $this->Security->blackHoleCallback = 'forceSSL'; $this->Security->requireSecure(); } function forceSSL() { $this->redirect('https://' . $_SERVER['SERVER_NAME'] . $this->here); } But whenever I go to a page using this controller, I get redirected to my login page with the message "You are not authorized to access that location." I am using Auth in my appcontroller. I'm guessing that has something to do with it. But for the life of me I cannot figure it out. This is the code in my AppController for Auth: $this->Auth->fields = array('username' => 'email', 'password' => 'password'); //$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login'); $this->Auth->loginRedirect = '/'; $this->Auth->logoutRedirect = '/'; $this->Auth->allow('*'); $this->Auth->loginError = 'Invalid e-mail / password combination. Please try again'; $this->Auth->autoRedirect = false; $this->Auth->authorize = 'controller'; --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Ajax & Uploads with Cake
Hi Will, Basically in sites, to achieve ajax uploading effect,iframe functionality has been used. It's not pure we can say that Ajax upload. I have used one good jQuery plug-ins, http://www.uploadify.com/demo/ Here Ajax like functionality and flash support. Due to flash support, you can also upload multiple files with file uploading progress bar. Hope that it will help to you. Best Regards, Shadab On Fri, Oct 30, 2009 at 9:41 AM, Will Poillion wrote: > > Does anyone have a link to a tutorial explaining how to do uploads > using ajax? > > One that includes JQuery would be even better, and pertaining to cake, > to a lesser degree, but mainly I need to learn how to do file uploads > using ajax, and hopefully avoid some common pitfalls along the way. > > > Thanks! > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to retrieve validation errors on model save?
Yes setFlash doesnt work in AJAX. If you want to use true ajax, return the success as a JSON response. On Oct 29, 8:57 pm, Will Poillion wrote: > Simple question: > > I'm attempting to save a model, and the data to be saved is not > passing the validation rules. How do I retrieve the validation error? > > if ($this->Ingredient->IngredientImage->save($this->data)) { > //success > $this->Session->setFlash(__('The Ingredient Image has been saved', > true));} else { > > // retrieve validation error and return to view > > } > > Also, am I correct in assuming that setFlash is useless in an ajax > call? I know I'm a noob but I'm not sure how I would use the setflash > and flash functionality in an ajax call. Any clue as to how to do this > would be most appreciated. > > Thanks! > Will --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Problem with view obtained from baking
Hii, When we tried to edit the baked views like add.ctp, view.ctp etc the changes made in the forms are not reflecting. How to track this problem ? Plz Help. regards, jiru --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Ajax & Uploads with Cake
Does anyone have a link to a tutorial explaining how to do uploads using ajax? One that includes JQuery would be even better, and pertaining to cake, to a lesser degree, but mainly I need to learn how to do file uploads using ajax, and hopefully avoid some common pitfalls along the way. Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to retrieve validation errors on model save?
Simple question: I'm attempting to save a model, and the data to be saved is not passing the validation rules. How do I retrieve the validation error? if ($this->Ingredient->IngredientImage->save($this->data)) { //success $this->Session->setFlash(__('The Ingredient Image has been saved', true)); } else { // retrieve validation error and return to view } Also, am I correct in assuming that setFlash is useless in an ajax call? I know I'm a noob but I'm not sure how I would use the setflash and flash functionality in an ajax call. Any clue as to how to do this would be most appreciated. Thanks! Will --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to retrieve validation errors on model save?
Do not use invalidFields(), just use: $this->Model->validationErrors; invalidFields() causes your validation to run twice, which causes problems in some cases. On Oct 29, 5:50 pm, igotskils wrote: > On 29 Okt., 22:08, Will Poillion wrote: > > > > > Simple question: > > > I'm attempting to save a model, and the data to be saved is not > > passing the validation rules. How do I retrieve the validation error? > > > if ($this->Ingredient->IngredientImage->save($this->data)) { > > //success > > $this->Session->setFlash(__('The Ingredient Image has been saved', > > true));} else { > > > // retrieve validation error and return to view > > > } > > > Also, am I correct in assuming that setFlash is useless in an ajax > > call? I know I'm a noob but I'm not sure how I would use the setflash > > and flash functionality in an ajax call. Any clue as to how to do this > > would be most appreciated. > > > Thanks! > > Will > > ajax? don't no what you mean with that here but i would try: > > $this-set('validtionErrors',$this->Ingredient->IngredientImage- > > >invalidFields()); > > (dont forget the search function of the cookbook ;) ) > > matic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to retrieve validation errors on model save?
On 29 Okt., 22:08, Will Poillion wrote: > Simple question: > > I'm attempting to save a model, and the data to be saved is not > passing the validation rules. How do I retrieve the validation error? > > if ($this->Ingredient->IngredientImage->save($this->data)) { > //success > $this->Session->setFlash(__('The Ingredient Image has been saved', > true));} else { > > // retrieve validation error and return to view > > } > > Also, am I correct in assuming that setFlash is useless in an ajax > call? I know I'm a noob but I'm not sure how I would use the setflash > and flash functionality in an ajax call. Any clue as to how to do this > would be most appreciated. > > Thanks! > Will ajax? don't no what you mean with that here but i would try: $this-set('validtionErrors',$this->Ingredient->IngredientImage- >invalidFields()); (dont forget the search function of the cookbook ;) ) matic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Odd code in sanitize core lib?
I thought this was the case too (I use Consolas fwiw), so I pasted the code into an empty text editor (TextWrangler) and did a search for '!', and it returned two results. What font are you using to view the code, making the search and replace strings different? As far as I can tell, the search and replace strings are identical. I'm guessing it's some sort of testing code that wasn't cleaned up during the refactoring process...? I don't know. But yeah -- this isn't a ground-breaking drop-what-you're-doing kind of thing, just out of curiosity I was just wondering why that's there. On Oct 29, 11:47 pm, Martin Westin wrote: > I am just guessing here but couldn't it be replacing "looks like an > exclamation but is really far out into outfer space" with a normal > exclamation? > > Using a "bad" font and the code look different. > > On Oct 29, 7:32 am, Miles J wrote: > > > I thought you were lying so I checked, and haha it is there. Im > > curious on this as well. > > > On Oct 28, 8:51 pm, George H wrote: > > > > Hi guys, > > > > I've been debugging my controller that is using Sanitize and I had a > > > peek inside the CakePHP Sanitize core lib file, where I found > > > something odd. > > > > Is it possible if someone could explain to me (I'm just genuinely > > > curious) the reasoning behind line 223 in /cake/libs/sanitize.php > > > (version 1.2.5)? > > > > $data = str_replace("'", "'", str_replace("!", "!", $data)); > > > > From what I can tell, this line is replacing ! chars with !, and then > > > replacing ' chars with '. I've done some checks and the search and > > > replace strings are exactly the same. > > > > As I mentioned, I am genuinely curious (probably more curious if I am > > > lost my marbles or not and maybe I'm seeing things), so any core devs > > > out there please do not see this as a personal attack on you, or your > > > intelligence, or ability to cut good code, etc etc. > > > > Cheers, > > > -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: What the heck? CakePHP is dead?
Love the new design. Awesome. I think it should stay! On Oct 29, 2:45 pm, ProFire wrote: > I'm gonna mirror the entire website for memories!!! > Damn! CakePHP is AWESOME! Even in Halloween! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Ajax requests dont response with the correct content type
You need to set the JSON content-type manually. On Oct 29, 11:01 am, Zac Tolley wrote: > I'm using an ajax library on the client side of my application to > issue calls for json data from the cakephp server. > > In the request that is made to the controller the following header is > included: > > X-Requested-With : XMLHttpRequest > > As I understand it this should be recognised by cake so that the > response includes a header to flag that this is json content. The > response, however, has the content type set to 'text/html'. > > Am I missing something or do I need to do something in cake to make it > recodnise this as a json request and return the correct header? > > I --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 retrieve validation errors on model save?
Simple question: I'm attempting to save a model, and the data to be saved is not passing the validation rules. How do I retrieve the validation error? if ($this->Ingredient->IngredientImage->save($this->data)) { //success $this->Session->setFlash(__('The Ingredient Image has been saved', true)); } else { // retrieve validation error and return to view } Also, am I correct in assuming that setFlash is useless in an ajax call? I know I'm a noob but I'm not sure how I would use the setflash and flash functionality in an ajax call. Any clue as to how to do this would be most appreciated. Thanks! Will --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Find from multiple similar tables
Really interested in why simply doing two finds and merging the results would not do as you'll be processing all rows either way. What number of rows do you expect to query in total so I can understand the performance aspect of this. Would love to know your eventual outcome Mike Karthauser Brightstorm limited Tel: 07939252144 On 29 Oct 2009, at 19:23, "ge...@dinnerbooking.com" wrote: > > I have two tables: > > houses > houses_stat > > The two tables are the same but old data from "houses" are moved to > "houses_stat" by a cron job. > > Now I want to find all houses in both tables where "price" equals > "1000" > > A find in one table would be: > $houses->find("all", array("conditions" => array("price" => 1000))); > > but how do I lookup data in both tables in one find? > > How do I do that? > > Do I need to use some kind of bindModel or? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Find from multiple similar tables
I don't think there is a very cakeish way to do this, of course you could use a UNION statement in your sql query but then you wouldn't get any of the benefits from the ORM. On Thu, Oct 29, 2009 at 5:23 PM, ge...@dinnerbooking.com < ge...@dinnerbooking.com> wrote: > > I have two tables: > > houses > houses_stat > > The two tables are the same but old data from "houses" are moved to > "houses_stat" by a cron job. > > Now I want to find all houses in both tables where "price" equals > "1000" > > A find in one table would be: > $houses->find("all", array("conditions" => array("price" => 1000))); > > but how do I lookup data in both tables in one find? > > How do I do that? > > Do I need to use some kind of bindModel or? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Find from multiple similar tables
I have two tables: houses houses_stat The two tables are the same but old data from "houses" are moved to "houses_stat" by a cron job. Now I want to find all houses in both tables where "price" equals "1000" A find in one table would be: $houses->find("all", array("conditions" => array("price" => 1000))); but how do I lookup data in both tables in one find? How do I do that? Do I need to use some kind of bindModel or? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Ajax requests dont response with the correct content type
I'm using an ajax library on the client side of my application to issue calls for json data from the cakephp server. In the request that is made to the controller the following header is included: X-Requested-With : XMLHttpRequest As I understand it this should be recognised by cake so that the response includes a header to flag that this is json content. The response, however, has the content type set to 'text/html'. Am I missing something or do I need to do something in cake to make it recodnise this as a json request and return the correct header? I --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
help - could not display uploaded image file to user
i am a newbie to cakephp. i am moving the user uploaded file to a new directory and passing this new image location to the view. but view was unable to display the file. Thanks, Ramesh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Relationship Confusion
Hi Dave, Look in the cook book at: http://book.cakephp.org/view/851/Multiple-relations-to-the-same-model There it is explained how to do it! Enjoy, John On Oct 29, 4:29 pm, "Dave" wrote: > Can someone help me out with this situation. Will try to explain as simple > as possible. > > User A creates an ad => he selling a lawnmower (Ads) > User B views the ad belonging to User A and wants to click "Interested" > which will make a record in the DB table called "Interests" > > I need the table to be accessed by both User A and User B for different > reason. User A will see who is interested in his offers, and User B will see > all the offers he is interested in. > > But how do you define that relationship? cant be 2 user_id's in the table.. > Interests Table: > id > seller_id => the ad owner user_id > buyer_id => the interested user_id > > But the User to Interests relationship...how can you determine the keys for > this? > > Thanks in advance for any help > > Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
HABTM - retrieve items from ModelA that *are not* linked to a particular item from ModelB
Hello all, Assuming two hypothetical models, Post and Tag, joined with a HABTM relationship, of course it's trivial to retrieve a list of all Posts which are linked to a particular Tag. However, if I wanted to retrieve a list of all Posts which *are not* linked to a particular Tag, what would be the best approach? Of course, I could first retrieve a list of all Posts, then retrieve a list of Posts linked to the Tag, and then manually iterate through the array 'removing' one from the other, but is there a better way? Grateful for any suggestions. Cheers, toby --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How I can integrate cakephp into Joomla.
Other than the great looking templates, once I got involved with cake, I didn't see much benefit to Joomla anymore. Very few of the Joomla extensions are really of commercial value to a developer. Keymaster, do you Joomla for templates or do you have another solution? On Oct 15, 7:16 am, keymaster wrote: > > Please tell what the benefit of this is? > > A better benefit might be to build a bridging component to the > hundreds ofJoomlatemplates (without using theJoomlaCMS codebase). > > Other than the great looking templates, once I got involved with cake, > I didn't see much benefit toJoomlaanymore. Very few of theJoomla > extensions are really of commercial value to a developer. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Saving data to three models from one form
>From what I have done, saveAll would work on HABTM relations, not the others. On Oct 29, 3:39 am, Daniel wrote: > I'm not sure that's totally correct as I'm using saveAll quite > successfully in another part of the site to create new records in two > different models. The Chapter and Path models in fact - the code I'm > using for this new feature is based on it. > > On Oct 28, 5:15 pm, Miles J wrote: > > > If you are saving date for the first time (inserting), you cannot use > > saveAll. The foreign keys and relations will not be set. This only > > works for updating, and when you do an update the IDs need to be > > hidden in the form somewhere. > > > You need to do it like > > so:http://book.cakephp.org/view/75/Saving-Your-Data#Saving-Related-Model... > > > On Oct 28, 10:04 am, Daniel wrote: > > > > I am using saveAll: > > > > if ($this->Story->saveAll($this->data, array('validate' => > > > 'first'))) // passed validation and successfully saved > > > > Unless you mean without the array('validate' => 'first') - in which > > > case the validation only works for the Story model. > > > > On Oct 28, 4:58 pm, Celso wrote: > > > > > Use saveAll > > > > > On 28 out, 13:19, Daniel wrote: > > > > > > Hi guys, I've got a bit of a problem. Rather than type it all out > > > > > again here, is it OK if I just link to my blog with all the info: > > > > > >http://theworldofdan.co.uk/2009/10/28/problem-saving-data-to-three-mo... > > > > > > I would really appreciate it if someone is able to help me out with > > > > > this. Thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: The action delete is not defined in controller PostsController
That worked, thank you! On Oct 29, 11:30 am, Andras Kende wrote: > Your add function is not closed ... try this: > > class PostsController extends AppController { > var $name = 'Posts'; > > function index() { > $this->set('posts', $this->Post->find('all')); > > } > > function view($id = null) { > $this->Post->id = $id; > $this->set('post', $this->Post->read()); > > } > > function add() { > if (!empty($this->data)) { > if ($this->Post->save($this->data)) { > $this->Session->setFlash('Your post has been saved.'); > $this->redirect(array('action'=> 'index')); > } > } > > } > > function delete($id) { > $this->Post->delete($id); > $this->Session->setFlash('The post with id: '.$id.' has been > deleted.'); > $this->redirect(array('action'=> 'index')); > > } > } > > ?> > > Andras Kende > > On Oct 29, 2009, at 10:23 AM, artmyth wrote: > > > > > Hi, > > > I just installed cake 1.2.5 - kudos for the easy installation.. > > > I am going through the 1.2 blog > > tutorialhttp://book.cakephp.org/view/219/Blog > > and have run into an error on step 10.1.11 Deleting Posts.. > > > I receive this error when I click on delete: > > > -- > > Missing Method in PostsController > > > Error: The action delete is not defined in controller PostsController > > > Error: Create PostsController::delete() in file: app/controllers/ > > posts_controller.php. > > > > class PostsController extends AppController { > > > var $name = 'Posts'; > > > function delete() { > > > } > > > } > > ?> > > > > My posts_controller.php file looks like this: > > > > > > class PostsController extends AppController { > > var $name = 'Posts'; > > function index() { > > $this->set('posts', $this->Post->find('all')); > > } > > > function view($id = null) { > > $this->Post->id = $id; > > $this->set('post', $this->Post->read()); > > } > > > function add() { > > if (!empty($this->data)) { > > if ($this->Post->save($this->data)) { > > $this->Session->setFlash('Your post has been saved.'); > > $this->redirect(array('action'=> 'index')); > > } > > > function delete($id) { > > $this->Post->delete($id); > > $this->Session->setFlash('The post with id: '.$id.' has been > > deleted.'); > > $this->redirect(array('action'=> 'index')); > > } > > } > > } > > } > > ?> > > - > > > So I am hoping I can receive some direction on correcting my code or > > install to proceed with the tutorial. > > > All the best --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: giving $text doesnt work
How is this CakePHP related. And also, shouldn't it be $_GET['text'] ? On Oct 29, 7:17 am, hamburger wrote: > Hello I have the following html code: > http://opteynde.com/bild.php?text=hello";> > > And this PHP code > header("Content-type: image/jpg"); > if (!isset($text)) > { > $text = "Missing data"; > } > > $font = 4; > $width = ImageFontWidth($font) * strlen($text); > $height = ImageFontHeight($font); > > $im = @imagecreate ($width,$height); > //white background > $background_color = imagecolorallocate > ($im, 255, 255, 255); > //black text > $text_color = imagecolorallocate ($im, 0, 0,0); > imagestring ($im, $font, 0, 0, $text, $text_color); > > imagejpeg ($im); > ?> > > The result is allways "Missing data" and not hello. > Whats wrong??? > Thanks for a quick answer in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
could nested elements cause recursion in the ajax component?
I have an element right.ctp with the code echo ""; echo $this->element('pplcollection'); echo "".$ajax->dropRemote('dropzone',null,array('url' => '/ casts/ remuser/','with'=>'{draggedid:element.id}'', 'update'=>'res')); The pplcollection.ctp element has the code below echo $this->requestAction('casts/showcast'); // this should set initial values if (isset($users)){ foreach ($users as $user){ echo "". $html->image ('users/'.$user['Image']['filename'], array('alt' => '', 'width' => '30')).""; } } my controller has the code called in the requestaction above as function showcast(){ $this->loadModel('UserProfile'); $userlist = $this->UserProfile->getlist($this->Session- >read ('productid')); $this->loadModel('Image'); $users = $this->Image->getList($userlist); $this->set('users', $users); $this->render('/elements/pplcollection'); } The problem is that the 2nd query is causing recursion. The image model the query is running on has a belongsTo relationship but has var $recursive = -1; and has no other relationships. Each time I try load this page I get timeouts from the cake core although the 1st query is returning only 1 result so the 2nd query equates to " SELECT `Image`.`id`, `Image`.`filename`, `Image`.`alttext`, `Image`.`user_profile_id` FROM `images` AS `Image` WHERE user_profile_id = (8) ". I've run the queries in a regular view and they run fine. I'm using R1.25 stable. Any help greatly appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: The action delete is not defined in controller PostsController
Your add function is not closed ... try this: set('posts', $this->Post->find('all')); } function view($id = null) { $this->Post->id = $id; $this->set('post', $this->Post->read()); } function add() { if (!empty($this->data)) { if ($this->Post->save($this->data)) { $this->Session->setFlash('Your post has been saved.'); $this->redirect(array('action'=> 'index')); } } } function delete($id) { $this->Post->delete($id); $this->Session->setFlash('The post with id: '.$id.' has been deleted.'); $this->redirect(array('action'=> 'index')); } } ?> Andras Kende On Oct 29, 2009, at 10:23 AM, artmyth wrote: > > Hi, > > I just installed cake 1.2.5 - kudos for the easy installation.. > > I am going through the 1.2 blog tutorial http://book.cakephp.org/view/219/Blog > and have run into an error on step 10.1.11 Deleting Posts.. > > I receive this error when I click on delete: > > -- > Missing Method in PostsController > > Error: The action delete is not defined in controller PostsController > > Error: Create PostsController::delete() in file: app/controllers/ > posts_controller.php. > > class PostsController extends AppController { > > var $name = 'Posts'; > > > function delete() { > > } > > } > ?> > > My posts_controller.php file looks like this: > > > class PostsController extends AppController { > var $name = 'Posts'; > function index() { > $this->set('posts', $this->Post->find('all')); > } > > function view($id = null) { > $this->Post->id = $id; > $this->set('post', $this->Post->read()); > } > > function add() { > if (!empty($this->data)) { > if ($this->Post->save($this->data)) { > $this->Session->setFlash('Your post has been saved.'); > $this->redirect(array('action'=> 'index')); > } > > function delete($id) { > $this->Post->delete($id); > $this->Session->setFlash('The post with id: '.$id.' has been > deleted.'); > $this->redirect(array('action'=> 'index')); >} > } > } > } > ?> > - > > So I am hoping I can receive some direction on correcting my code or > install to proceed with the tutorial. > > All the best > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: The action delete is not defined in controller PostsController
link(__('Delete', true), array('action'=>'delete', $post['Post']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $post['Post']['id'])); ?> function delete($id = null) { if (!$id) { $this->Session->setFlash(__('Invalid id for Posts', true)); $this->redirect(array('action'=>'index')); } if ($this->Post->del($id)) { $this->Session->setFlash(__('Post deleted', true)); $this->redirect(array('action'=>'index')); } } On Oct 29, 7:23 am, artmyth wrote: > Hi, > > I just installed cake 1.2.5 - kudos for the easy installation.. > > I am going through the 1.2 blog tutorialhttp://book.cakephp.org/view/219/Blog > and have run into an error on step 10.1.11 Deleting Posts.. > > I receive this error when I click on delete: > > -- > Missing Method in PostsController > > Error: The action delete is not defined in controller PostsController > > Error: Create PostsController::delete() in file: app/controllers/ > posts_controller.php. > > class PostsController extends AppController { > > var $name = 'Posts'; > > function delete() { > > } > > } > > ?> > > My posts_controller.php file looks like this: > > > class PostsController extends AppController { > var $name = 'Posts'; > function index() { > $this->set('posts', $this->Post->find('all')); > > } > > function view($id = null) { > $this->Post->id = $id; > $this->set('post', $this->Post->read()); > > } > > function add() { > if (!empty($this->data)) { > if ($this->Post->save($this->data)) { > $this->Session->setFlash('Your post has been saved.'); > $this->redirect(array('action'=> 'index')); > > } > > function delete($id) { > $this->Post->delete($id); > $this->Session->setFlash('The post with id: '.$id.' has been > deleted.'); > $this->redirect(array('action'=> 'index')); > } > } > } > } > ?> > - > > So I am hoping I can receive some direction on correcting my code or > install to proceed with the tutorial. > > All the best --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Is there an easy way to add new HABTM "connections" ..?
Ok, I will explain it differently. Let's say I've got three tables: posts, tags and posts_tags. posts and tags have a lot of records already and let's say now I want to add some more associations between existing posts and tags. What should I do in this case? On Oct 29, 7:10 pm, jayarjo wrote: > I've got another problem with that HABTM thingy :( I've got two tables > associated with each other with HABTM. Both of them already having > plenty of records. Let's say I want just to add some more > "connections" to their join table and only them. Is there a way to do > it automagicly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
giving $text doesnt work
Hello I have the following html code: http://opteynde.com/bild.php?text=hello";> And this PHP code The result is allways "Missing data" and not hello. Whats wrong??? Thanks for a quick answer in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
The action delete is not defined in controller PostsController
Hi, I just installed cake 1.2.5 - kudos for the easy installation.. I am going through the 1.2 blog tutorial http://book.cakephp.org/view/219/Blog and have run into an error on step 10.1.11 Deleting Posts.. I receive this error when I click on delete: -- Missing Method in PostsController Error: The action delete is not defined in controller PostsController Error: Create PostsController::delete() in file: app/controllers/ posts_controller.php. My posts_controller.php file looks like this: set('posts', $this->Post->find('all')); } function view($id = null) { $this->Post->id = $id; $this->set('post', $this->Post->read()); } function add() { if (!empty($this->data)) { if ($this->Post->save($this->data)) { $this->Session->setFlash('Your post has been saved.'); $this->redirect(array('action'=> 'index')); } function delete($id) { $this->Post->delete($id); $this->Session->setFlash('The post with id: '.$id.' has been deleted.'); $this->redirect(array('action'=> 'index')); } } } } ?> - So I am hoping I can receive some direction on correcting my code or install to proceed with the tutorial. All the best --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Is there an easy way to add new HABTM "connections" ..?
I've got another problem with that HABTM thingy :( I've got two tables associated with each other with HABTM. Both of them already having plenty of records. Let's say I want just to add some more "connections" to their join table and only them. Is there a way to do it automagicly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Problems cakephp 1.2.5
i know that when i switch to cake 1.2.0 7962 Final it works just fine when i switch to 1.2.5 it dose that here is the code when a user register it sends email to that user and how come it empty when i can see data stored in database function afterSave($created) { if ($created) { $this->sendMail($this->id); } } function sendMail($conditions = array()) { if (is_numeric($conditions)) { $id = $conditions; } elseif (is_string($conditions)) { $id = $this->field('id', array('User.email' => $conditions)); } else { $id = $this->field('id', $conditions); } if (!$id) { return false; } $data = array( 'id' => $id, 'email_token' => $this->generateToken(), 'email_token_expires' => date('Y-m-d H:i:s', time() + DAY) ); if ($this->save($data)) { $data = $this->read(); $MiEmail = ClassRegistry::init('MiEmail'); $MiEmail->create(); $MiEmail->send(array( 'from_user_id' => 0, 'to_user_id' => $this->id, 'to' => "{$data['User']['first_name']} {$data['User'] ['last_name']} <{$data['User']['email']}>", 'template' => 'users/welcome', 'data' => $data, 'subject' => __('Welcome New User, true) )); return true; } else { return false; } } On Oct 28, 11:13 am, Miles J wrote: > Well then theres your problem. Figure out why user is empty. Should of > probably debugged that before blaming extract. > > On Oct 28, 9:37 am, Sergio Silva wrote: > > > > > $data = array( > > "User" => null > > ) > > > User data is null!! > > > 2009/10/28 Simon : > > > > ___viewFn = > > > "C:\xampp\htdocs\one\vendors\base\views\elements\email\html > > > \users/welcome.ctp" > > > $___dataForView = array( > > > "content" => "", > > > "html" => HtmlHelper > > > HtmlHelper::$tags = array > > > HtmlHelper::$base = NULL > > > HtmlHelper::$here = NULL > > > HtmlHelper::$params = array > > > HtmlHelper::$action = NULL > > > HtmlHelper::$data = array > > > HtmlHelper::$_crumbs = array > > > HtmlHelper::$__docTypes = array > > > HtmlHelper::$helpers = NULL > > > HtmlHelper::$webroot = NULL > > > HtmlHelper::$themeWeb = NULL > > > HtmlHelper::$plugin = NULL > > > HtmlHelper::$namedArgs = NULL > > > HtmlHelper::$argSeparator = NULL > > > HtmlHelper::$validationErrors = NULL > > > HtmlHelper::$__tainted = NULL > > > HtmlHelper::$__cleaned = NULL > > > HtmlHelper::$_log = NULL > > > HtmlHelper::$name = "HtmlHelper", > > > "session" => SessionHelper > > > SessionHelper::$helpers = NULL > > > SessionHelper::$__active = true > > > SessionHelper::$valid = false > > > SessionHelper::$error = false > > > SessionHelper::$_userAgent = "c82e7b6a933757f629da37bc1114e73f" > > > SessionHelper::$path = "/" > > > SessionHelper::$lastError = NULL > > > SessionHelper::$security = NULL > > > SessionHelper::$time = 1256747395 > > > SessionHelper::$sessionTime = false > > > SessionHelper::$watchKeys = array > > > SessionHelper::$id = NULL > > > SessionHelper::$_log = NULL > > > SessionHelper::$base = NULL > > > SessionHelper::$webroot = NULL > > > SessionHelper::$here = NULL > > > SessionHelper::$params = array > > > SessionHelper::$action = NULL > > > SessionHelper::$data = array > > > SessionHelper::$themeWeb = NULL > > > SessionHelper::$plugin = NULL > > > ) > > > $loadHelpers = true > > > $cached = false > > > $loadedHelpers = array( > > > "Html" => HtmlHelper > > > HtmlHelper::$tags = array > > > HtmlHelper::$base = NULL > > > HtmlHelper::$here = NULL > > > HtmlHelper::$params = array > > > HtmlHelper::$action = NULL > > > HtmlHelper::$data = array > > > HtmlHelper::$_crumbs = array > > > HtmlHelper::$__docTypes = array > > > HtmlHelper::$helpers = NULL > > > HtmlHelper::$webroot = NULL > > > HtmlHelper::$themeWeb = NULL > > > HtmlHelper::$plugin = NULL > > > HtmlHelper::$namedArgs = NULL > > > HtmlHelper::$argSeparator = NULL > > > HtmlHelper::$validationErrors = NULL > > > HtmlHelper::$__tainted = NULL > > > HtmlHelper::$__cleaned = NULL > > > HtmlHelper::$_log = NULL > > > HtmlHelper::$name = "HtmlHelper", > > > "Session" => SessionHelper > > > SessionHelper::$helpers = NULL > > > SessionHelper::$__active = true > > > SessionHelper::$valid = false > > > SessionHelper::$error = false > > > SessionHelper::$_userAgent = "c8
Re: What the heck? CakePHP is dead?
I'm gonna mirror the entire website for memories!!! Damn! CakePHP is AWESOME! Even in Halloween! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Relationship Confusion
Can someone help me out with this situation. Will try to explain as simple as possible. User A creates an ad => he selling a lawnmower (Ads) User B views the ad belonging to User A and wants to click "Interested" which will make a record in the DB table called "Interests" I need the table to be accessed by both User A and User B for different reason. User A will see who is interested in his offers, and User B will see all the offers he is interested in. But how do you define that relationship? cant be 2 user_id's in the table.. Interests Table: id seller_id => the ad owner user_id buyer_id => the interested user_id But the User to Interests relationship...how can you determine the keys for this? Thanks in advance for any help Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Model->saveAll() return value issue
There is another strange (in my opinion) behavior of saveAll() - as you can see in my previous post in second parameter I use 'validate'=>'first' to validate all records before save any (as is described in manual and api). But even if any of array elements doesn't pass validation, other elements are stored as well Is this a bug or I'm missing something On Oct 29, 12:52 pm, senser wrote: > Hello guys, > > I'm trying to use Model->saveAll() in one of my projects for saving > multiple model records (not associations). Hera is structured data I > try to save: > > Array > ( > [Email] => Array > ( > [0] => Array > ( > [email_id] => 8 > [employee_mailbox_id] => 77 > [notes] => > ) > > [1] => Array > ( > [email_id] => 8 > [employee_mailbox_id] => 5 > [notes] => > ) > > [2] => Array > ( > [email_id] => 8 > [employee_mailbox_id] => 1 > [notes] => > ) > > ) > > As you can see model name is "Email" and I want to store three records > in corresponding table at once with following controller code: > $this->Email->create($data['Email']); > $result=$this->Email->saveAll > ($data['Email'], array('validate'=>'first', 'atomic'=>false)); > > My confusion is caused by the return value ot saveAll function - it is > array containing 5 elements but not 3. Elements with value 1 for > succeeded elements and 0 for unsuccessful stored elements suppose. > > Am I wrong or missing something and how can I retrieve what elements > are stored successfully and what are failed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP memcache Cache engine questions.
yes, its supposed to be $this->User->find(. I removed the unnecessary fields in the find when i made the post to the mailing group, and made the typo when i didnt copy and paste that part exactly. But going back to the main point, I did some testing yesterday, and it seems it will always try and use the first memcache server pool(which is the first memcache configuration). It's unable change the servers on the fly using Cache::config because in the init it's using addServer, and will only do this for the first pool. is this a bug where additional memcache servers specified in Cache::config are not used? Has anyone gotten Cache::config for different memcache working? I might just have to do it without cakephp then, so I can choose where im read/writing to. I know phpmemcached has add/get/setByKey to chose which server in the pool to query, whereas phpmemcache does not. so that could be an option for me, if it's not possible using cakephp's memcache engine. I'm spliting up my memcache queries to different ports to minimize collisions, allow me to set different size memcache instances, and if i ever need to resize a particular memcache instance, or have to flush, I dont have to reload the cache for unrelated memcache instances. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Overriding a model's order when it has a different className
Hi. I've got a model, Product, which has its $order variable set to 'Product.name ASC'. Usually this works fine, as you'd expect. The tricky bit is that Product hABTM itself. When it does this, it obviously needs to give the second instance of itself a different className to avoid conflicts, so I specify the new className in the order too: var $hasAndBelongsToMany = array( 'Recommendation' => array( 'className' => 'Product', 'joinTable' => 'recommended_products', 'foreignKey' => 'viewed_product_id', 'associationForeignKey' => 'recommended_product_id', 'order' => 'Recommendation.name ASC', 'unique' => true ) ); The bit I can't work out is why 'Recommendation.name ASC' appears to be ignored. The query still tries to order by 'Product.name ASC', so it doesn't work. Although this happens to be a hABTM relationship, I've had the same issues with others, such as a tree which belongsTo and hasMany itself. I'm sure I'm missing something obvious, but can't figure out what. Is there a simple way to override the model's default order when it has a different className, so I don't need to manually specify it in the find queries? Thanks, Zoe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Additional Field in HABTM
Can you add additional fields to HABTM tables? Users <-> Skills User can select their skill and have an extra field where they can put in a numeric value for years with that experience? Thanks Dave --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Using Cake amongst existing non-cake site
Huh? I may be missing something but why couldn't you just put your cake install in a subfolder on the site and then do some htaccess RewriteRule magic? Something like: RewriteEngine On RewriteRule^$ app/webroot/[PT] RewriteRule(.*) app/webroot/$1 [L] That's what we are doing over here. In Georgia. It's all the rage! Ian On Oct 29, 4:30 am, Gaioshin wrote: > One method to do it - depending on how convoluted and hard coded the > existing site is - is simply to try and migrate it over to the webroot > folder of your CakePHP app. That way, you can reuse the CSS and > JavaScript routines where necessary. Of course, you may still need to > keep any database tables separate - naturally a lot of this depends on > existing site design. > > gaioshin > > On Oct 29, 8:23 am, "www.landed.at" wrote: > > > > > I disagree , cake seems to be flexible enough to me to be able to do > > this. Isn't this how routes could be used to ignore the old site > > url's ? > > Or a better way is that cake just ends up producing widgets that you > > could insert into the static site. > > I do agree with you miles that its not a good thing to do in general > > and there would be some work but cake seems to be ABLE. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Alternatives to Security Component Authentication with cgi php
After re-reading Jeff's solution (and getting some sleep) I tried it out and it worked perfectly! Thanks! On Oct 28, 11:21 pm, Ken wrote: > I think that this might be what I'm looking for, but I don't think > I've quite figured it out. I've followed the steps you've outlined, > but I'm unclear on how to implement the last beforeFilter function > since I'm using another authenticate function. I think I'm probably > missing something simple, but any help would be appreciated. This > works well on other servers, but not on a server with php as cgi. > > function beforeFilter() { > > $this->Auth->allow('feed'); > $this->Security->loginOptions = array( > 'type'=>'basic', > 'login'=>'authenticate', > 'realm'=>'CaseMojo iCal Feed', > ); > > $this->Security->loginUsers = array(); > $this->Security->requireLogin('feed'); > > parent::beforeFilter(); > > } > > function authenticate($args) { > > $data[ $this->Auth->fields['username'] ] = $args > ['PHP_AUTH_USER']; > $data[ $this->Auth->fields['password'] ] = $this->Auth->password > ($args['PHP_AUTH_PW']); > if ( $this->Auth->login($data) ) { > return true; > } else { > $this->Security->blackHole($this, 'login'); > > return false; > } > } > > On Sep 5, 5:57 pm, Jeff Deroshia wrote: > > > > > I was able to find a workaround using mod_rewrite (a module that continues > > to amaze me with its usefulness). So for anyone else who needs to use the > >httpauthenticationmethods of the Security Component while running php > > through cgi, here's what I did to get it working: > > > In the .htaccess file in the webroot dir, I modified the default rewrite > > rule by removing the 'last' flag: > > > old: RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] > > new: RewriteRule ^(.*)$ index.php?url=$1 [QSA] > > > Then I added another RewriteRule below that one, giving it the 'last' flag I > > took away from the previous rule: > > > RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L] > > > This new rule sets the environment variable REMOTE_USER to the value of the > >HTTPAuthorization header. With basicauthentication, which is what I am > > using since I'm behind an SSL connection, the Authorization string consists > > of the word 'Basic', a space, and a base64 encoded string of the supplied > > username and password separated by a colon (:). > > > Php adds this new environment variable to the $_SERVER superglobal array > > with the key 'REDIRECT_REMOTE_USER'. So, in my beforeFilter callback I've > > added the following code: > > > if(Configure::read('in_production') { > > list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , > > base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6))); > > > } > > > Now the variables that the Security Component (and php) use forHTTP > >Authenticationare set, which makes functionality that was only explicitly > > available in the apache php module also available in sites that have to use > > php through CGI/FastCGI > > > mod_rewrite rocks. > > > J3ffy > > > On Fri, Sep 4, 2009 at 10:23 AM, J3ffy wrote: > > > I've been developing a system that does server-to-server communication > > > using BasicHTTPAuth forauthenticationbehind an SSL connection. > > > The requests are created and sent with the HttpSocket class. The > > > component that receives the requests uses the Security component to > > > force and checkauthentication. > > > > Everything has been working great on multiple test systems, but on the > > > production host, none of theAuthenticationcredentials were being > > > seen by the app. After a few hours of testing I discovered that on > > > all my test systems I'm using the Apache php module, but on the > > > production server, the php api is access through FastCGI. According > > > to the php documentation forHTTPauthenticationhere: > > >http://us3.php.net/manual/en/features.http-auth.phptheHTTP > > >authenticationhooks are only available when using the apache module > > > and not for php through cgi. > > > > It seems that I'm going to have to change my approach to > > > authenticating, but I have no idea what to change it to. Do you folks > > > have any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Multi-value field in cake
when get a problem with multi-value ,I think this code can help you ,this is me code , Controllers: function add() { if (!empty($this->data)) { $this->Wine->create(); //saveAll(), NOT save() if ($this->Wine->saveAll($this->data)) { $this->Session->setFlash(__('The Wine has been saved', true)); $this->redirect(array('action'=>'index')); } else { $this->Session->setFlash(__('The Wine could not be saved. Please, try again.', true)); } } $grapes = $this->Wine->Grape->find('list'); //multi-value $types = $this->Wine->Type->find('list'); $wineries = $this->Wine->Winery->find('list'); $this->set(compact('grapes', 'types', 'wineries')); } view input('name', array('label' => __('Name', true))); echo $form->input('description', array('label' => __('Description', true))); echo $form->input('year', array('label' => __('Year', true))); echo $form->input('selling_price', array('label' => __('Selling Price', true))); echo $form->input('discount', array('label' => __('Discount', true))); echo $form->input('type_id', array('label' => __('Type', true))); echo $form->input('winery_id', array('label' => __('Winery', true))); echo $form->input('Grape', array('label' => __('Grape', true), 'multiple' => 'checkbox')); //multi-value, checkbox echo $form->input(null, array('label' => __('WinePhoto', true), 'type' => 'file', 'name' => 'data[WinePhoto][]', 'id' => 'files')); echo $html->link('+', '#', array('id' => 'file-more')); ?> all ok --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP memcache Cache engine questions.
You probably want to call $this->SomeModelName->find('first', in controller, right? ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to: A user logs in from a second location and the first location's session gets killed?
Which token? Where do I get that "ID" from? The whole Session? On Oct 28, 7:12 pm, Miles J wrote: > You need to save the session ID/token to the database. On each page > load you check to see if the current ID/token matches the one in the > database, if it does not, you log them out. > > So if A logs in and has a token, hell be fine. > Once B logs in, a new token is created nad logged in the database. > A will be logged out since his token does not match the DB one. B will > be ok. > > On Oct 28, 9:48 am, "j0n4s.h4rtm...@googlemail.com" > > wrote: > > Hi, > > > the subject essentially asks the whole question already. > > > How did you detect that a user logs in from a second location, and > > kick him from the first location? The first location should display a > > warning on the next action that requires to be logged in like "You > > have been logged out automatically on this machine because this user > > was logged in at another location"... > > > Any hints? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Odd code in sanitize core lib?
I am just guessing here but couldn't it be replacing "looks like an exclamation but is really far out into outfer space" with a normal exclamation? Using a "bad" font and the code look different. On Oct 29, 7:32 am, Miles J wrote: > I thought you were lying so I checked, and haha it is there. Im > curious on this as well. > > On Oct 28, 8:51 pm, George H wrote: > > > > > Hi guys, > > > I've been debugging my controller that is using Sanitize and I had a > > peek inside the CakePHP Sanitize core lib file, where I found > > something odd. > > > Is it possible if someone could explain to me (I'm just genuinely > > curious) the reasoning behind line 223 in /cake/libs/sanitize.php > > (version 1.2.5)? > > > $data = str_replace("'", "'", str_replace("!", "!", $data)); > > > From what I can tell, this line is replacing ! chars with !, and then > > replacing ' chars with '. I've done some checks and the search and > > replace strings are exactly the same. > > > As I mentioned, I am genuinely curious (probably more curious if I am > > lost my marbles or not and maybe I'm seeing things), so any core devs > > out there please do not see this as a personal attack on you, or your > > intelligence, or ability to cut good code, etc etc. > > > Cheers, > > -- George --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => Group [Aro0.foreign_key] => 1 )
I am sure using the Auth Compoment and ACL Component ! I think I do All things about Auth and Acl , but not take effect --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => Group [Aro0.foreign_key] => 1 )
On 29 Okt., 10:08, merrylin wrote: > when I do Auth with cake , I happened a problem > Warning (512): AclNode::node() - Couldn't find Aro node identified by > "Array > ( > [Aro0.model] => Group > [Aro0.foreign_key] => 1 > ) > " [CORE\cake\libs\model\db_acl.php, line 191] Hey, are you using only the Auth Compoment? Or did you try to use the ACL Component too? The error comes from the ARO Object and the ACL Component. For better help, try to post the controller code including the beforeFilter method and the component variable. Or maybe this link is going to help you: http://book.cakephp.org/view/171/Access-Control-Lists matic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: "null" response on Ajax request
it was set to 2 but AjaxHandler component was setting it back to 0 - disabled it and found out that the problem was coming from a missing file in the live server - rookie error :o) thanks a lot for that On Thu, Oct 29, 2009 at 4:04 AM, Dr. Loboto wrote: > > Set debug to at least 1 (and no matter that it is ajax) to see error. > > On Oct 28, 10:34 pm, Thanos Atskakanis > wrote: > > Hi all, > > > > I am currently building a CMS and my system does some ajax requests which > > return some html: simple and nice. > > When I run it locally it all works fine but when I put it live instead of > > the expected html I get "null". Not "Not found" or any other error, just > the > > word "null". > > > > All I use is the RequestHandler component and the following line of code: > > $this->render('/path/to/element'); > > I also use milesjohnson's AjaxHandler component somewhere else in my > > controller, but it doesn't seem to be the problem because I tested > without > > it and everything was fine... > > > > Here are the response headers I get in both servers: > > > > Live ("null" response): > > > > DateWed, 28 Oct 2009 16:08:26 > GMTServerApacheX-Powered-ByPHP/5.2.11P3PCP="NOI > > ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"Set-CookieCAKEPHP=deleted; > > expires=Tue, 28-Oct-2008 16:08:26 GMT; path=/ > > CAKEPHP=0svbs500eu74f9613mjd02sn71; > > path=/Content-Length4ConnectioncloseContent-Typetext/html; charset=UTF-8 > > > > Locally (normal html response): > > > > DateWed, 28 Oct 2009 16:08:35 GMTServerApache/2.2.12 (Ubuntu)X-Powered-By > > PHP/5.2.10-2ubuntu4P3PCP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM" > > Set-CookieCAKEPHP=deleted; expires=Tue, 28-Oct-2008 16:08:35 GMT; > > path=/johnross CAKEPHP=c37700dbbbf3d009cfa920695637118a; path=/mypathVary > > Accept-EncodingContent-EncodinggzipContent-Length50Keep-Alivetimeout=15, > > max=87ConnectionKeep-AliveContent-Typetext/html; charset=UTF-8 > > > > Anyone who came across a similar situation? > > > > Thanks, > > Thanos > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Tree reorder tweaking
Hi. I'm trying to order a tree such that for any given node on the tree, all its children appear alphabetically, including the top level. If I understand the reorder() method correctly (it has sparse documentation at http://book.cakephp.org/view/229/Advanced-Usage#reorder-518 but the API at http://api.cakephp.org/class/tree-behavior#method-TreeBehaviorreorder is more informative), then you need to pass it the IDs that need editing. I want to reorder the whole entire tree though, so I made my own reorderAll() method in /app/app_model.php: function reorderAll($options = array()) { $parentIDs = $this->find('list', array( 'fields' => array( 'parent_id' ) )); $parentIDs = array_unique($parentIDs); foreach ($parentIDs as $parentID) { if (!empty($parentID)) { $options['id'] = $parentID; $this->reorder($options); } } } Is this a good way of approaching it? The most obvious problem I can see at the moment is that the top level still isn't getting alphabetised, and I'm not sure how to do this. I'm also still not sure if reorder() recurses as far as it can, or just one level. Thanks for any help or suggestions! Zoe. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
CORE/cake/libs/model/db_acl.php, line 191
Hi, I'm trying to use ACL in my application, I have pretty much followed this tutorial http://book.cakephp.org/view/641/Simple-Acl-controlled-Application to get my application up and running, however, when I visit any of the pages that are supposed to be protected, I get this error: Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => User [Aro0.foreign_key] => 1 ) " [CORE/cake/libs/model/db_acl.php, line 191] Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => Group [Aro0.foreign_key] => 1 ) " [CORE\cake\libs\model\db_acl.php, line 191] Any help will be greatly appreciated. Thanks and happy holidays! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => Group [Aro0.foreign_key] => 1 )
when I do Auth with cake , I happened a problem Warning (512): AclNode::node() - Couldn't find Aro node identified by "Array ( [Aro0.model] => Group [Aro0.foreign_key] => 1 ) " [CORE\cake\libs\model\db_acl.php, line 191] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
CakePHP memcache Cache engine questions.
I'm having difficulty getting CakePHP to use more than one memcache server. I only have 1 memcached server, and i would like to read/write to different ports, but it doesnt seem to be working well for me... in my controller: I have the following code: $ck = md5('user_auth'.$user_id); if(!$salt = Cache::read($ck,'userauth')){ $salt = $this->find('first', array('fields'=>array ('id','salt'),'conditions'=>array('User.id'=>$user_id))); if($salt){ Cache::write($ck,$salt,'userauth'); } } else if ($salt) { return $salt; } but it doesnt seem to be doing anything with the 'userauth' config i'm specifiying. If i do a Cache::settings('Memcache'); before the read/write, I'm getting:Array ( [prefix] => app_ [duration] => 3600 [probability] => 100 [engine] => Memcache [servers] => Array ( [0] => 192.168.133.71:11213 ) [compress] => ) which is the 3rd memcache config specified. I've even tried to do a Cache::set(Cache::settings('Memcache')); before the read/writes but no luck. Is this the way cakephp works with the memcache engine? any way to tell the cache engine to use a different port atleast, or set it? in my core.php, I have the following relevant sections: Configure::write('Cache.disable', false); Configure::write('Cache.check', false); Cache::config('default', array('engine' => 'File')); Cache::config('messages', array( 'engine' => 'Memcache', //[required] 'duration'=> 3600, //[optional] 'servers' => array('192.168.133.71:11214') 'compress' => false, )); Cache::config('userauth', array( 'engine' => 'Memcache', //[required] 'duration'=> 3600, //[optional] 'servers' => array('192.168.133.71:11212'), 'compress' => false, )); Cache::config('subscriptions', array( 'engine' => 'Memcache', //[required] 'duration'=> 3600, //[optional] 'servers' => array('192.168.133.71:11213'), 'compress' => false, )); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
HABTM relations. How to insert?
Hi. I have a problem :) I've got a HABTM relation between Users and Groups. After linking the models together, I'm having trouble understanding how to create a new row in the Groups table (from the groups controller) and, automatically, creating a new record in the groups_users table. For example: - when a user creates a new group, he should become a member of that group as well as the administrator of the same. The administrator is a boolean field present in the groups_users table. Also: - how, after having the id of a Group and an User, can I update the corresponding row in the join table? Updating the administrator field for example? (assuming I'm executing all of this From the Group Controller) Can someone help me? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Alternatives to Security Component Authentication with cgi php
I think that this might be what I'm looking for, but I don't think I've quite figured it out. I've followed the steps you've outlined, but I'm unclear on how to implement the last beforeFilter function since I'm using another authenticate function. I think I'm probably missing something simple, but any help would be appreciated. This works well on other servers, but not on a server with php as cgi. function beforeFilter() { $this->Auth->allow('feed'); $this->Security->loginOptions = array( 'type'=>'basic', 'login'=>'authenticate', 'realm'=>'CaseMojo iCal Feed', ); $this->Security->loginUsers = array(); $this->Security->requireLogin('feed'); parent::beforeFilter(); } function authenticate($args) { $data[ $this->Auth->fields['username'] ] = $args ['PHP_AUTH_USER']; $data[ $this->Auth->fields['password'] ] = $this->Auth->password ($args['PHP_AUTH_PW']); if ( $this->Auth->login($data) ) { return true; } else { $this->Security->blackHole($this, 'login'); return false; } } On Sep 5, 5:57 pm, Jeff Deroshia wrote: > I was able to find a workaround using mod_rewrite (a module that continues > to amaze me with its usefulness). So for anyone else who needs to use the > http authentication methods of the Security Component while running php > through cgi, here's what I did to get it working: > > In the .htaccess file in the webroot dir, I modified the default rewrite > rule by removing the 'last' flag: > > old: RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] > new: RewriteRule ^(.*)$ index.php?url=$1 [QSA] > > Then I added another RewriteRule below that one, giving it the 'last' flag I > took away from the previous rule: > > RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L] > > This new rule sets the environment variable REMOTE_USER to the value of the > HTTP Authorization header. With basic authentication, which is what I am > using since I'm behind an SSL connection, the Authorization string consists > of the word 'Basic', a space, and a base64 encoded string of the supplied > username and password separated by a colon (:). > > Php adds this new environment variable to the $_SERVER superglobal array > with the key 'REDIRECT_REMOTE_USER'. So, in my beforeFilter callback I've > added the following code: > > if(Configure::read('in_production') { > list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':' , > base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6))); > > } > > Now the variables that the Security Component (and php) use for HTTP > Authentication are set, which makes functionality that was only explicitly > available in the apache php module also available in sites that have to use > php through CGI/FastCGI > > mod_rewrite rocks. > > J3ffy > > > > On Fri, Sep 4, 2009 at 10:23 AM, J3ffy wrote: > > I've been developing a system that does server-to-server communication > > using Basic HTTP Auth for authentication behind an SSL connection. > > The requests are created and sent with the HttpSocket class. The > > component that receives the requests uses the Security component to > > force and check authentication. > > > Everything has been working great on multiple test systems, but on the > > production host, none of the Authentication credentials were being > > seen by the app. After a few hours of testing I discovered that on > > all my test systems I'm using the Apache php module, but on the > > production server, the php api is access through FastCGI. According > > to the php documentation for HTTP authentication here: > >http://us3.php.net/manual/en/features.http-auth.phpthe HTTP > > authentication hooks are only available when using the apache module > > and not for php through cgi. > > > It seems that I'm going to have to change my approach to > > authenticating, but I have no idea what to change it to. Do you folks > > have any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Model->saveAll() return value issue
Hello guys, I'm trying to use Model->saveAll() in one of my projects for saving multiple model records (not associations). Hera is structured data I try to save: Array ( [Email] => Array ( [0] => Array ( [email_id] => 8 [employee_mailbox_id] => 77 [notes] => ) [1] => Array ( [email_id] => 8 [employee_mailbox_id] => 5 [notes] => ) [2] => Array ( [email_id] => 8 [employee_mailbox_id] => 1 [notes] => ) ) As you can see model name is "Email" and I want to store three records in corresponding table at once with following controller code: $this->Email->create($data['Email']); $result=$this->Email->saveAll ($data['Email'], array('validate'=>'first', 'atomic'=>false)); My confusion is caused by the return value ot saveAll function - it is array containing 5 elements but not 3. Elements with value 1 for succeeded elements and 0 for unsuccessful stored elements suppose. Am I wrong or missing something and how can I retrieve what elements are stored successfully and what are failed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Multi-value field in cake
Hi all, Can anybody tell me what the best practises are for multi-value fields in Cake? The binary set as described here http://planet.mysql.com/entry/?id=21976 looks interesssting but I'm wondering if there are alternative ways (csv per example). I want multiple checkboxes that can be checked/unchecked and save the values in the db. I hope this makes sense. Thanks! Edwin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Saving data to three models from one form
I'm not sure that's totally correct as I'm using saveAll quite successfully in another part of the site to create new records in two different models. The Chapter and Path models in fact - the code I'm using for this new feature is based on it. On Oct 28, 5:15 pm, Miles J wrote: > If you are saving date for the first time (inserting), you cannot use > saveAll. The foreign keys and relations will not be set. This only > works for updating, and when you do an update the IDs need to be > hidden in the form somewhere. > > You need to do it like > so:http://book.cakephp.org/view/75/Saving-Your-Data#Saving-Related-Model... > > On Oct 28, 10:04 am, Daniel wrote: > > > I am using saveAll: > > > if ($this->Story->saveAll($this->data, array('validate' => > > 'first'))) // passed validation and successfully saved > > > Unless you mean without the array('validate' => 'first') - in which > > case the validation only works for the Story model. > > > On Oct 28, 4:58 pm, Celso wrote: > > > > Use saveAll > > > > On 28 out, 13:19, Daniel wrote: > > > > > Hi guys, I've got a bit of a problem. Rather than type it all out > > > > again here, is it OK if I just link to my blog with all the info: > > > > >http://theworldofdan.co.uk/2009/10/28/problem-saving-data-to-three-mo... > > > > > I would really appreciate it if someone is able to help me out with > > > > this. Thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---
find list - group results using assoc field
Hi! I have this assoc: Group belongsTo Country Im trying to get this array(to generate a select with form helper): Array( [Country.name] => Array ( [Group.id] => [Group.name] ... ) ... ) Example: Array ( [Spain] => Array ( [1] => Spain Admins ) [Germany] => Array ( [2] => Germany Support [3] => Germany Admins ) [Netherland] => Array ( [4] => Netherland Translator ) ) But doing this I get an error [Unknown column 'Country.name']: $groups = $this->Group->find('list', array('fields' => array('id', 'name', 'Country.name'))); Any suggestion? Thanks, and excuse my bad english! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: What's going on with www.cakephp.org?
You all had me going there with all the twitter updates. I thought it was hilarious, the new design is awesome and the zombie translation is just the icing on the cake. Definitely put a much needed smile on my face after the fiasco earlier. =) <3 Cake! On Oct 28, 6:57 am, "jitka (poLK)" wrote: > When I saw some public reactions on recent team fork, first of all, I > was surprised people thinks CakePHP aims to its grave. Then, I was > surprised by amount of blogs who actually thinks CakePHP will die. > Well, not just core developers, all tens of thousands of monthly cake > downloaders and users, we all can just laugh. CakePHP doesn't need to > draw an attention in any way; we just thought you will enjoy undead > cake, because every single body from this community is very important > to us and when we saw you're sad, we had to do something asap to put a > smile on your face. > > Here you go - something to laugh at, but then BACK TO WORK, it is just > funny design and one .po file. Although, made by 2 front CakePHP > developers for you. That doesn't happen often to have them working on > a joke to comfort you and wipe your tears out, you know ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with DATE.
Using the form-helper, change the input for the date to: $form->input('date', array('minYear' => 1950)). When the input is for something like a birthday, you can also add a 'maxYear' => 2000 or something to that last array since obviously nobody born in 2029 will be using your site now. :) On 29 okt, 05:45, Jiru wrote: > Hii Programmers , > > In cakephp when I use DATE field it displays the dropdown list with > year limit 1989-2029 how can we get the date from 1950? > > regards, > jiru --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problem with DATE.
Hello, Please,next time support your question with your code. The attribute you need is 'minYear', please check out the manual and API to get more information: http://book.cakephp.org/view/189/Automagic-Form-Elements#options-minYear-options-maxYear-480 http://api.cakephp.org/class/form-helper#method-FormHelperyear On Oct 29, 5:45 am, Jiru wrote: > Hii Programmers , > > In cakephp when I use DATE field it displays the dropdown list with > year limit 1989-2029 how can we get the date from 1950? > > regards, > jiru --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Dynamic routes
If you do not need $cat in controller: Router::connect( '/(categories|kategorie)/*', array('controller' => 'categories', 'action' => 'view') ); On Oct 29, 5:23 am, kicaj wrote: > Why doesn't work: Router::connect('/:cat/*', array('controller' => > 'categories', 'action' => 'view'), array('cat' => '[categories| > kategorie]')); ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Using Cake amongst existing non-cake site
One method to do it - depending on how convoluted and hard coded the existing site is - is simply to try and migrate it over to the webroot folder of your CakePHP app. That way, you can reuse the CSS and JavaScript routines where necessary. Of course, you may still need to keep any database tables separate - naturally a lot of this depends on existing site design. gaioshin On Oct 29, 8:23 am, "www.landed.at" wrote: > I disagree , cake seems to be flexible enough to me to be able to do > this. Isn't this how routes could be used to ignore the old site > url's ? > Or a better way is that cake just ends up producing widgets that you > could insert into the static site. > I do agree with you miles that its not a good thing to do in general > and there would be some work but cake seems to be ABLE. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Using Cake amongst existing non-cake site
"Add something to Cake site" can be simple - put that "something" into cake webroot. But not the other way. I don't think that your client will be happy to see his site inside cake when he asked only add new section. Of course you can put cake into subfolder and use hardcoded absolute links to css/img/js etc files, but it does not look good. On Oct 29, 3:02 am, dtirer wrote: > Lets say someone has a website that was done using no framework. Then > they come to me and ask me to add a large section onto the site. I > would like to use Cake for that section of the site. However, how > does that work with the existing design and layout of the site? If > the rest of the site already has certain stylesheets and such, how do > I make it so that will also be used in the Cake portion of the site? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: Using Cake amongst existing non-cake site
I disagree , cake seems to be flexible enough to me to be able to do this. Isn't this how routes could be used to ignore the old site url's ? Or a better way is that cake just ends up producing widgets that you could insert into the static site. I do agree with you miles that its not a good thing to do in general and there would be some work but cake seems to be ABLE. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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: What the heck? CakePHP is dead?
mmmu models mu views.. muggghhhrhr :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email 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 -~--~~~~--~~--~--~---