Add class to active links
Hi I am using cakphp 'link' to generate anchor tags. Now i awnt to add a class to active links to apply some styling to those links. Is there a way to that. -- *Thank you,* *Kiran.* -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media PLugin
Gosh my reply sounded harsh on you Jeremy - that wasn't my intention. We've commented out the line that unsets the data and it *all seems fine*, which also feels dirty. The user records are saving correctly, we can subsequently add images to user records and all other dedicated image tables that use the coupler are functioning too. I did reach out to David yesterday, hoping to learn more from him so that we can implement this properly and will report back. Jeremy Burns Class Outfit http://www.classoutfit.com On 28 Feb 2012, at 21:15:25, jeremyharris wrote: > I didn't say I agreed with how it worked, I was just explaining what I think > the author's intended use case was. The question was if you were missing a > setting or doing anything wrong. You weren't, so I just threw out some ideas > based on how the Coupler works. Feel free to take it up with the author or > create a Coupler that works for you. > > I'm glad that an empty image doesn't create garbage data, that thought was > based off of what the Coupler does down the road (check the file and populate > dirname and basename). > > On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote: > I understand what you are saying but I don't think it's the full answer. It's > a perfectly valid use case to have a table that has an optional image in it > without the need to have a separate join table. The absence of the image > doesn't create any garbage data; the user row is still valid. A bio snap for > a user is good example. For the plugin to simply clear the whole data array > because the optional image fields aren't populated is nuts. If the fields are > empty simply return true and let the main model get on with its work. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 28 Feb 2012, at 15:45:29, jeremyharris wrote: > >> It should only unset the data if you are creating the User and it's missing >> the 'file' key. If you are updating, you shouldn't *need* the 'file' key. >> >> That said, you can probably get away with passing an empty (or a path to a >> default image) file key when you are creating the User using a hidden field. >> This should allow the coupler to continue with the save. This may save some >> empty garbage data that is probably unwanted. >> >> The other solution would be to detach the Coupler behavior at runtime when >> you don't want it to "force" you to have an image. >> >> The whole point of the Coupler is to tightly couple the physical image to >> the record, so if the image doesn't exist neither should the record. I tend >> to create a separate table for attachments for this very reason. A user >> should be allowed to exist without an image. >> >> On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote: >> I'm using David Persson's media plugin. I have a users table that >> contains the fields necessary to link to an image file, but a user >> does not have to have an image. When I include the Media.Coupler >> behaviour in the User model User->create always fails on User->save >> when the user does not have an image because of the beforeSave in >> coupler.php: >> >> function beforeSave(&$Model) { >> if (!$Model->exists()) { >> if (!isset($Model->data[$Model->alias]['file'])) { >> unset($Model->data[$Model->alias]); <<<--- >> clears down my User >> data >> return true; >> } >> } else { >> >> This is unsetting the User data because the file key is missing. If I >> comment out the unset my User->save is successful. The Media.Coupler >> is working perfectly well for another table that hasMany images in an >> associated table. >> >> Is there a setting I need to configure or am I doing something else >> wrong? >> >> -- >> Our newest site for the community: CakePHP Video Tutorials >> http://tv.cakephp.org >> Check out the new CakePHP Questions site http://ask.cakephp.org and help >> others with their CakePHP related questions. >> >> >> To unsubscribe from this group, send email to >> cake-php+unsubscr...@googlegroups.com For more options, visit this group at >> http://groups.google.com/group/cake-php > > > On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote: > I understand what you are saying but I don't think it's the full answer. It's > a perfectly valid use case to have a table that has an optional image in it > without the need to have a separate join table. The absence of the image > doesn't create any garbage data; the user row is still valid. A bio snap for > a user is good example. For the plugin to simply clear the whole data array > because the optional image fields aren't populated is nuts. If the fields are > empty simply return true and let the main model get on with its work. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com >
Re: CakePHP Paypal returning link not working with SSL
Thanks for the response lowpass. The controller allows ipn, but not returning. However, after further testing, I found that not only was I being returned to the login page, I was actually logged out. I found this when trying to go to other places on the site and found that it shows the login instead of my welcome. I have a status bar at the top of all my pages that show either a login box or a welcome showing the user's name. On Feb 28, 2:17 pm, lowpass wrote: > Are you sure that the controller that handles the return action > specifically allows that action? > > function beforeFilter() > { > parent::beforeFilter(); > $this->Auth->allow(array('ipn', 'returning')); > > } > > (or whatever the actual names are) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Model Array index issue
I have a weird problem with Models and array's I moved a website from a test server to the live server. In the new situate all my code started to complaine about undefined indexes. When debugging an array I see that the array indexes became numbers instead of the Model names!? What can be the problem of that I use the exact same installation of cakephp? Below the 2 examples of arrays. this is how the array should be. - Array ( [0] => Array ( [MenuItemsTemplates] => Array ( [id] => 152 [menu_item_id] => 1 ) ) This is the array on the live server Array ( [0] => Array ( [0] => Array ( [id] => 152 [menu_item_id] => 1 ) ) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Filter on a deep model association
Your second proposition is close to what I need, but my Grail would be to have the list of the authors (sorted alphabetically) each with its associated books published in a given collection. I guess that with some tweaking of the array of results I can get there but it's not very elegant. Thanks again. On 28 fév, 23:16, lowpass wrote: > Go 3 levels deep so the data is arranged by the particular Collection > you're after. > > $data = $this->Author->Book->Collection->find( > 'first', > array( > 'conditions' => array( > 'Collection.id' = $c_id > ), > 'contain' => array( > 'Book' => array( > 'Author' > ) > ) > ) > ); > > Because the Book model has the collection_id you really only need to > go 2 models deep. > > $data = $this->Author->Book->find( > 'all', > array( > 'conditions' => array( > 'Book.collection_id' = $c_id > ), > 'contain' => array( > 'Collection', > 'Author' > ) > ) > ); > > But then the data will be arranged badly. Collection, for instance, > will be repeated for each Book. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: App::import() in 2.x
I find it odd that Nick used a class for this in the first place, as it only has a single array of options. It's loaded in both the component and behavior. I think it would be simpler to just put all of this in the plugin's bootstrap so I'll try rewriting it like that. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: App::import() in 2.x
On Tue, Feb 28, 2012 at 5:15 PM, Tilen Majerle wrote: > App::uses('FileUploadSettings', 'FileUpload.Config'); Oh, I'm a dolt. I was forgetting that it's not a configuration file, but a class. But it still doesn't work. I get class not found on the line with: $FileUploadSettings = new FileUploadSettings; -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Filter on a deep model association
Go 3 levels deep so the data is arranged by the particular Collection you're after. $data = $this->Author->Book->Collection->find( 'first', array( 'conditions' => array( 'Collection.id' = $c_id ), 'contain' => array( 'Book' => array( 'Author' ) ) ) ); Because the Book model has the collection_id you really only need to go 2 models deep. $data = $this->Author->Book->find( 'all', array( 'conditions' => array( 'Book.collection_id' = $c_id ), 'contain' => array( 'Collection', 'Author' ) ) ); But then the data will be arranged badly. Collection, for instance, will be repeated for each Book. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: App::import() in 2.x
App::uses('FileUploadSettings', 'FileUpload.Config'); -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/2/28 lowpass > App::import('FileUploadSettings', 'FileUpload.Config'); > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Filter on a deep model association
By filter I mean to select all authors where Collection is equal to a collection_id and do it from the authors controller. I can't simply do a $this->Author- >find('all',array('conditions'=>array('Collection.id'=> $collection_id)) because the Author model is not associated with the Collection model. Thanks for helping. On 28 fév, 20:32, lowpass wrote: > What do you mean by filtered? Do you want to sort by Collection, or do > you want to select only specific Collections? > > And which controller/model do you want to do this from? Because the > models are associated, code from, eg. the Book model can run a find() > from the Collection model. $this->Book->Collection->find(...) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
App::import() in 2.x
I'm attempting to port Nick Baker's FileUpload plugin to 2.x but am running into class not found errors. He used a separate FileUploadSettings class that's in the config folder. I've renamed the folder Config and the file FileUploadSettings.php. Then I've changed the import line in the component. //App::import('Config', 'FileUpload.file_upload_settings'); App::import('FileUploadSettings', 'FileUpload.Config'); But no dice. I also tried 'Plugin.FileUpload.Config'. Could someone please explain how import is supposed to work now? For the basic things, it seems pretty straightforward, but I'm lost for something like this. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
MVC design for shopping cart
Hi, I'm currently trying to create a shopping cart solution with cake 1.3. In the current design, only the product id of a chosen product will be saved in the session, each time the customer lists the cart items, all information needs to be read out of the database. My idea was to create a seperated model (no relation to any table) where all cart calculations can happen in, which can then be used in several controllers. However, this would mean that this cart class would need to use several other product related models (product details, taxes, countrydetails, etc.), which is not easily supported by cake, since it breaks the MVC model. The workaround would be to implement the logic in a controller where I can easily access all models, however, this breaks two other basics, once the "fat model skinny controller" rule and on the other hand the code is not easily reusable for other purposes. My question is now how where to implement the cart functionality (e.g. summary price, discount, taxes calculation, etc.) without breaking MVC but with sticking to "fat model skinny controller" and the re- usability of my code. Thanks, Christian -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media PLugin
I didn't say I agreed with how it worked, I was just explaining what I think the author's intended use case was. The question was if you were missing a setting or doing anything wrong. You weren't, so I just threw out some ideas based on how the Coupler works. Feel free to take it up with the author or create a Coupler that works for you. I'm glad that an empty image doesn't create garbage data, that thought was based off of what the Coupler does down the road (check the file and populate dirname and basename). On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote: > > I understand what you are saying but I don't think it's the full answer. > It's a perfectly valid use case to have a table that has an optional image > in it without the need to have a separate join table. The absence of the > image doesn't create any garbage data; the user row is still valid. A bio > snap for a user is good example. For the plugin to simply clear the whole > data array because the optional image fields aren't populated is nuts. If > the fields are empty simply return true and let the main model get on with > its work. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 28 Feb 2012, at 15:45:29, jeremyharris wrote: > > It should only unset the data if you are creating the User and it's > missing the 'file' key. If you are updating, you shouldn't *need* the > 'file' key. > > That said, you can probably get away with passing an empty (or a path to a > default image) file key when you are creating the User using a hidden > field. This should allow the coupler to continue with the save. This may > save some empty garbage data that is probably unwanted. > > The other solution would be to detach the Coupler behavior at runtime when > you don't want it to "force" you to have an image. > > The whole point of the Coupler is to tightly couple the physical image to > the record, so if the image doesn't exist neither should the record. I tend > to create a separate table for attachments for this very reason. A user > should be allowed to exist without an image. > > On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote: >> >> I'm using David Persson's media plugin. I have a users table that >> contains the fields necessary to link to an image file, but a user >> does not have to have an image. When I include the Media.Coupler >> behaviour in the User model User->create always fails on User->save >> when the user does not have an image because of the beforeSave in >> coupler.php: >> >> function beforeSave(&$Model) { >> if (!$Model->exists()) { >> if (!isset($Model->data[$Model->alias]['file'])) >> { >> unset($Model->data[$Model->alias]); >> <<<--- clears down my User >> data >> return true; >> } >> } else { >> >> This is unsetting the User data because the file key is missing. If I >> comment out the unset my User->save is successful. The Media.Coupler >> is working perfectly well for another table that hasMany images in an >> associated table. >> >> Is there a setting I need to configure or am I doing something else >> wrong? > > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > > > On Tuesday, February 28, 2012 12:06:23 PM UTC-8, Jeremy Burns wrote: > > I understand what you are saying but I don't think it's the full answer. > It's a perfectly valid use case to have a table that has an optional image > in it without the need to have a separate join table. The absence of the > image doesn't create any garbage data; the user row is still valid. A bio > snap for a user is good example. For the plugin to simply clear the whole > data array because the optional image fields aren't populated is nuts. If > the fields are empty simply return true and let the main model get on with > its work. > > Jeremy Burns > Class Outfit > > http://www.classoutfit.com > > On 28 Feb 2012, at 15:45:29, jeremyharris wrote: > > It should only unset the data if you are creating the User and it's > missing the 'file' key. If you are updating, you shouldn't *need* the > 'file' key. > > That said, you can probably get away with passing an empty (or a path to a > default image) file key when you are creating the User using a hidden > field. This should allow the coupler to continue with the save. This may > save some empty garbage data that is probably unwanted. > > The other solution would be to detach the Coupler behavior at runtime when > you don't want it to "force" yo
Re: big confusion with 2.x pagination
Sorry for the noise. It figures that I'd agonize over this for days, then spot the problem just minutes after giving and pleading for help. The issue is that 'page' is now expected to be under 'named' in $this->request->params. My route: Router::connect( '/admin/contributors/:page', array( 'admin' => 1, 'controller' => 'contributors', 'action' => 'index' ), array( 'page' => '[0-9]+' ) ); I like my routes the way they are so I made a quick fix in AppController::beforeFilter() if (isset($this->request->params['page'])) { $this->request->params['named']['page'] = $this->request->params['page']; } -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
big confusion with 2.x pagination
I'm having some trouble figuring out how pagination has changed. It appears as if the controller's $paginate array doesn't require any mods, but I can't get it to properly paginate. The SQL is all correct except that the offset is not included, so I always get the first page of results. Thinking it might be a problem with CakeRequest, I debugged $this->request->params: Array ( [plugin] => [controller] => contributors [action] => index [lang] => en [page] => 2 etc. Is this correct? The other thing I tried was adding Paginator to the controller's $components array. The docs are *really* vague on this. Is it necessary? Because without it, paginate() works (almost--see above) as expected. But, when I add it to $components, my $paginate array is completely ignored; associated data is missing, limit is incorrect, etc. It seems that what would normally go inside $paginate array now should be in $components under the 'Paginator' key. But, if that's the case, how come $paginate works otherwise. So confused. Can someone please clarify? Most importantly, how to pass the 'page' correctly? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media PLugin
I understand what you are saying but I don't think it's the full answer. It's a perfectly valid use case to have a table that has an optional image in it without the need to have a separate join table. The absence of the image doesn't create any garbage data; the user row is still valid. A bio snap for a user is good example. For the plugin to simply clear the whole data array because the optional image fields aren't populated is nuts. If the fields are empty simply return true and let the main model get on with its work. Jeremy Burns Class Outfit http://www.classoutfit.com On 28 Feb 2012, at 15:45:29, jeremyharris wrote: > It should only unset the data if you are creating the User and it's missing > the 'file' key. If you are updating, you shouldn't *need* the 'file' key. > > That said, you can probably get away with passing an empty (or a path to a > default image) file key when you are creating the User using a hidden field. > This should allow the coupler to continue with the save. This may save some > empty garbage data that is probably unwanted. > > The other solution would be to detach the Coupler behavior at runtime when > you don't want it to "force" you to have an image. > > The whole point of the Coupler is to tightly couple the physical image to the > record, so if the image doesn't exist neither should the record. I tend to > create a separate table for attachments for this very reason. A user should > be allowed to exist without an image. > > On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote: > I'm using David Persson's media plugin. I have a users table that > contains the fields necessary to link to an image file, but a user > does not have to have an image. When I include the Media.Coupler > behaviour in the User model User->create always fails on User->save > when the user does not have an image because of the beforeSave in > coupler.php: > > function beforeSave(&$Model) { > if (!$Model->exists()) { > if (!isset($Model->data[$Model->alias]['file'])) { > unset($Model->data[$Model->alias]); <<<--- > clears down my User > data > return true; > } > } else { > > This is unsetting the User data because the file key is missing. If I > comment out the unset my User->save is successful. The Media.Coupler > is working perfectly well for another table that hasMany images in an > associated table. > > Is there a setting I need to configure or am I doing something else > wrong? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group at > http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Filter on a deep model association
What do you mean by filtered? Do you want to sort by Collection, or do you want to select only specific Collections? And which controller/model do you want to do this from? Because the models are associated, code from, eg. the Book model can run a find() from the Collection model. $this->Book->Collection->find(...) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Accessing Folders/File Outside App Directory
You could set the path in bootstrap.php like Configure::write('uploadPath', '/path/from/root/of/server/etc'); But you may also run up against Open BaseDir (and maybe Safe Mode?) depending on your server's config. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP Paypal returning link not working with SSL
Are you sure that the controller that handles the return action specifically allows that action? function beforeFilter() { parent::beforeFilter(); $this->Auth->allow(array('ipn', 'returning')); } (or whatever the actual names are) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Filter on a deep model association
Hi, I have these 3 associated models : class Author extends AppModel { var $hasAndBelongsToMany = array('Book'); } class Book extends AppModel { var $belongsTo = array('Collection'); var $hasAndBelongsToMany = array('Author'); } class Collection extends AppModel { var $hasMany = array('Book'); } I need to find the list of all the authors (with their associated books) filtered by collection. I tried with the containable behaviour but I can only filters on the Collection level. Any help would be appreciated. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.1 & Configure::store, trouble
Hi, Deletion occurs at the end, after copying the files from the temp folder in the Config folder. Please try the following code and tell me that the settings.php file is created in your / tmp / cache / persistent / folder? Configure::store('Setting', 'settings', array('Site'=> array('title' => 'title example','slogan' => 'my not working example'))); Pozdrav -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Date out of the V2.1 Stable
Generally the response to this question is: when it's done. It's important to understand that CakePHP is a completely volunteer-driven framework. This means that people (core team and otherwise) put in unpaid time after their normal job. Because of this, there isn't a hard and fast release schedule. You'll just have to be patient and wait and see. Of course, you can always help it come out faster by closing tickets and contributing :) On Tuesday, February 28, 2012 8:33:55 AM UTC-8, fitoussi...@gmail.com wrote: > > Hi all, > > I currently work in a web agency and we wonder, when the stable > version of 2.1 will come out. For now V2.1 R.C > We will work on big projects and big change apparently will be made. > > Thank you in advance for your to answer. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: CakePHP 2.1 & Configure::store, trouble
how you know if file is created, if you delete it then ? :D and CONFIGS does not exists in cake 2, use APP . 'Config' . DS instead :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/2/28 Salines > Hello, I need your help. > > In the previous version of *CakePHP (1.3.4)* I can use the Configure:: > store to save my settings, as follows: > > http://bin.cakephp.org/view/1327054859 > > Now in *version** **2.1*, I use the following code > http://bin.cakephp.org/view/1594623852 > > But this code does not create temp file in /tmp/cache/persisten / as it > does the one before. > > Am I wrong somewhere? > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Can't set checkbox value to 0
I am not using the 'checked' attribute at all, but the info on the way php interprets this is good to know- thanks. On Tue, Feb 28, 2012 at 4:52 PM, jeremyharris wrote: > The 'checked' key just checks the checkbox. If you set the value to '0' > Cake (well, PHP) sees that as an empty value and therefore assigns it a > value (the default being 1). > > You have a few of options here: > 1. Use unconventional string values like 'on' and 'off' > 2. Flip the results in the model before saving > 3. Make the checkboxes not inverted > > Pick your poison. > > > On Tuesday, February 28, 2012 4:52:52 AM UTC-8, Boyan Penev wrote: >> >> Hello, >> >> i want to use a checkbox with inverted results: if checked- the value >> would be 0 and if not- 1, for which i am using the value attributes of both >> the checkbox and the corresponding hidden field: >> >> $formMarkup = array('verification_needed' = array('label' => __('Don\'t >> verify'), 'type' => 'checkbox', 'value' => 0, 'hiddenField' => >> array('value' => 1), 'name' =>'Registration[verification_**needed]')); >> echo $this->Form->inputs($**formMarkup); >> >> However, i can't get the part whith checked = 0 working. The source of >> the rendered page shows that the value of the checkbox (as well as the >> value of the hidden field) has the value=1. >> If i set any other value to the checkbox- like 555 or "yes" - it gets >> correctly assigned, but if i try 0- the value is always 1. >> >> Is this behavior normal and how could i set the value to 0? >> >> I use cake 2.1 >> >> Best regards, >> >> Boyan >> > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Date out of the V2.1 Stable
Hi all, I currently work in a web agency and we wonder, when the stable version of 2.1 will come out. For now V2.1 R.C We will work on big projects and big change apparently will be made. Thank you in advance for your to answer. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Can't set checkbox value to 0
The 'checked' key just checks the checkbox. If you set the value to '0' Cake (well, PHP) sees that as an empty value and therefore assigns it a value (the default being 1). You have a few of options here: 1. Use unconventional string values like 'on' and 'off' 2. Flip the results in the model before saving 3. Make the checkboxes not inverted Pick your poison. On Tuesday, February 28, 2012 4:52:52 AM UTC-8, Boyan Penev wrote: > > Hello, > > i want to use a checkbox with inverted results: if checked- the value > would be 0 and if not- 1, for which i am using the value attributes of both > the checkbox and the corresponding hidden field: > > $formMarkup = array('verification_needed' = array('label' => __('Don\'t > verify'), 'type' => 'checkbox', 'value' => 0, 'hiddenField' => > array('value' => 1), 'name' =>'Registration[verification_needed]')); > echo $this->Form->inputs($formMarkup); > > However, i can't get the part whith checked = 0 working. The source of the > rendered page shows that the value of the checkbox (as well as the value of > the hidden field) has the value=1. > If i set any other value to the checkbox- like 555 or "yes" - it gets > correctly assigned, but if i try 0- the value is always 1. > > Is this behavior normal and how could i set the value to 0? > > I use cake 2.1 > > Best regards, > > Boyan > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Media PLugin
It should only unset the data if you are creating the User and it's missing the 'file' key. If you are updating, you shouldn't *need* the 'file' key. That said, you can probably get away with passing an empty (or a path to a default image) file key when you are creating the User using a hidden field. This should allow the coupler to continue with the save. This may save some empty garbage data that is probably unwanted. The other solution would be to detach the Coupler behavior at runtime when you don't want it to "force" you to have an image. The whole point of the Coupler is to tightly couple the physical image to the record, so if the image doesn't exist neither should the record. I tend to create a separate table for attachments for this very reason. A user should be allowed to exist without an image. On Tuesday, February 28, 2012 5:42:11 AM UTC-8, Jeremy Burns wrote: > > I'm using David Persson's media plugin. I have a users table that > contains the fields necessary to link to an image file, but a user > does not have to have an image. When I include the Media.Coupler > behaviour in the User model User->create always fails on User->save > when the user does not have an image because of the beforeSave in > coupler.php: > > function beforeSave(&$Model) { > if (!$Model->exists()) { > if (!isset($Model->data[$Model->alias]['file'])) { > unset($Model->data[$Model->alias]); > <<<--- clears down my User > data > return true; > } > } else { > > This is unsetting the User data because the file key is missing. If I > comment out the unset my User->save is successful. The Media.Coupler > is working perfectly well for another table that hasMany images in an > associated table. > > Is there a setting I need to configure or am I doing something else > wrong? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP 2.1 & Configure::store, trouble
Hello, I need your help. In the previous version of *CakePHP (1.3.4)* I can use the Configure::store to save my settings, as follows: http://bin.cakephp.org/view/1327054859 Now in *version** **2.1*, I use the following code http://bin.cakephp.org/view/1594623852 But this code does not create temp file in /tmp/cache/persisten / as it does the one before. Am I wrong somewhere? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
I have debug 2. but it will not return a sql statement, it's an ajax based request anyway On 28 Feb., 14:02, Rodrigo Rodrigues Moyle wrote: > Set debug to 2 > > Em terça-feira, 28 de fevereiro de 2012 06h55min25s UTC-3, heohni escreveu: > > > > > > > > > > > well, if I do it like the book says, I get no sql error any more, but > > the if ($this->Auth->login()) fails without any comment. > > In this case, how can I get the sql statement debugged which is > > running? > > > On 28 Feb., 10:33, luca capra wrote: > > > Il 28/02/2012 09:55, heohni ha scritto: > > > > > I did this, see above? > > > > > On 28 Feb., 09:36, "@dariobarila" wrote: > > > >> Hello, > > > >> try to configure the Auth fields on the same level of $components = > > > >> array('Auth'); > > > > >> On 28 Feb, 09:33, heohni > > wrote: > > > >> ... > > > >>> $this->Auth->fields = array('username' => 'usr_username', > > > >>> 'password' => 'usr_password'); > > > >>> $this->Auth->allowedActions = array('display', 'index', > > > >>> 'add'); > > > >>> $this->Auth->autoRedirect = false; > > > >>> $this->Auth->logoutRedirect = array('controller' => > > > >>> 'bookmark', 'action' => 'search'); > > > >>> $this->Auth->loginRedirect = array('controller' => > > 'pages', > > > >>> 'action' => 'display', 'home'); > > > >>> } > > > > >>> ... > > > >>> SELECT `User`.`usr_id`, `User`.`usr_username`, > > `User`.`usr_password`, > > > >>> `User`.`created` FROM `project`.`users` AS `User` WHERE > > > >>> `User`.`username` = 'me' AND `User`.`password` = > > > >>> '998992c0dfcffb9ad442a85be2d636ba37228c3d' LIMIT 1 > > > > I think he means something like (read the book): > > > > $components = array( > > > 'Auth' => array( > > > 'authenticate' => array( > > > 'Form' => array( > > > "fields" => array( > > > 'username' => 'usr_nameuser', > > > 'password' => 'usr_wordpass' > > > ), > > > ) > > > ), > > > ); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Form helper issue with euro symbol
Hi, I have a form input which is taking in a rate title. This has worked fine in the past but when a euro symbol is added to a title Cake doesn't seem to be converting it to '&euro' as I would expect. The core file, layout and database are all using utf-8 encoding. I'm just wondering if there is some parameter I can add to the form input field to force Cake to convert the euro before saving? Any advice would be greatly appreciated... -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Media PLugin
I'm using David Persson's media plugin. I have a users table that contains the fields necessary to link to an image file, but a user does not have to have an image. When I include the Media.Coupler behaviour in the User model User->create always fails on User->save when the user does not have an image because of the beforeSave in coupler.php: function beforeSave(&$Model) { if (!$Model->exists()) { if (!isset($Model->data[$Model->alias]['file'])) { unset($Model->data[$Model->alias]); <<<--- clears down my User data return true; } } else { This is unsetting the User data because the file key is missing. If I comment out the unset my User->save is successful. The Media.Coupler is working perfectly well for another table that hasMany images in an associated table. Is there a setting I need to configure or am I doing something else wrong? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Map checkboxes to bitmask
that's exactly how the checkboxes get translated ;) on beforeValidate() - or manually On 28 Feb., 13:40, Boyan Penev wrote: > That was really helpful, and i will try to use it, thanks. > > But my problem is slightly different (I wasn't specific enough the first > time): > > i want to evaluate the whole result from the checkboxes. For example: > > None of the checkboxes checked = 0 > First-checked, second-not = 1 > First-not checked second-checked = 2 > Both checked = 3 > > Regards, > > Boyan > > On Sun, Feb 26, 2012 at 7:59 PM, euromark wrote: > > > > > > > > > seems like exactly the thing I did the last couple of days: > >http://www.dereuromark.de/2012/02/26/bitmasked-using-bitmasks-in-cake... > > although I used real bitmasks (integer)^^ > > > for the view you should then use a "multiple checkbox" form field > > > On 26 Feb., 13:29, Boyan Penev wrote: > > > Hello, > > > > I would like to accomplish the following: out of 2 checkboxes, if only > > the > > > first one is clicked, the value would be 10, if only the second one- 01, > > if > > > both - 11. I tried giving the checkboxes the same name(array) attribute > > and > > > different values, like: > > > $this->Form->input('example', array('type' => 'checkbox', 'name' => > > > 'checked[]', 'value' => 1) > > > and i get an indexed array over which i need to iterate in the > > controller. > > > Does anyone have an idea, how could i map the values directly in the > > view, > > > in order for the controller to receive the final result? > > > > Thanks, > > > > Boyan > > > -- > > Our newest site for the community: CakePHP Video Tutorials > >http://tv.cakephp.org > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help > > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > > cake-php+unsubscr...@googlegroups.com For more options, visit this group > > athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
Set debug to 2 Em terça-feira, 28 de fevereiro de 2012 06h55min25s UTC-3, heohni escreveu: > > well, if I do it like the book says, I get no sql error any more, but > the if ($this->Auth->login()) fails without any comment. > In this case, how can I get the sql statement debugged which is > running? > > On 28 Feb., 10:33, luca capra wrote: > > Il 28/02/2012 09:55, heohni ha scritto: > > > > > > > > > > > > > > > > > I did this, see above? > > > > > On 28 Feb., 09:36, "@dariobarila" wrote: > > >> Hello, > > >> try to configure the Auth fields on the same level of $components = > > >> array('Auth'); > > > > >> On 28 Feb, 09:33, heohni > wrote: > > >> ... > > >>> $this->Auth->fields = array('username' => 'usr_username', > > >>> 'password' => 'usr_password'); > > >>> $this->Auth->allowedActions = array('display', 'index', > > >>> 'add'); > > >>> $this->Auth->autoRedirect = false; > > >>> $this->Auth->logoutRedirect = array('controller' => > > >>> 'bookmark', 'action' => 'search'); > > >>> $this->Auth->loginRedirect = array('controller' => > 'pages', > > >>> 'action' => 'display', 'home'); > > >>> } > > > > >>> ... > > >>> SELECT `User`.`usr_id`, `User`.`usr_username`, > `User`.`usr_password`, > > >>> `User`.`created` FROM `project`.`users` AS `User` WHERE > > >>> `User`.`username` = 'me' AND `User`.`password` = > > >>> '998992c0dfcffb9ad442a85be2d636ba37228c3d'LIMIT 1 > > > > I think he means something like (read the book): > > > > $components = array( > >'Auth' => array( > > 'authenticate' => array( > > 'Form' => array( > > "fields" => array( > > 'username' => 'usr_nameuser', > > 'password' => 'usr_wordpass' > > ), > > ) > > ), > > ); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Can't set checkbox value to 0
Hello, i want to use a checkbox with inverted results: if checked- the value would be 0 and if not- 1, for which i am using the value attributes of both the checkbox and the corresponding hidden field: $formMarkup = array('verification_needed' = array('label' => __('Don\'t verify'), 'type' => 'checkbox', 'value' => 0, 'hiddenField' => array('value' => 1), 'name' =>'Registration[verification_needed]')); echo $this->Form->inputs($formMarkup); However, i can't get the part whith checked = 0 working. The source of the rendered page shows that the value of the checkbox (as well as the value of the hidden field) has the value=1. If i set any other value to the checkbox- like 555 or "yes" - it gets correctly assigned, but if i try 0- the value is always 1. Is this behavior normal and how could i set the value to 0? I use cake 2.1 Best regards, Boyan -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Map checkboxes to bitmask
That was really helpful, and i will try to use it, thanks. But my problem is slightly different (I wasn't specific enough the first time): i want to evaluate the whole result from the checkboxes. For example: None of the checkboxes checked = 0 First-checked, second-not = 1 First-not checked second-checked = 2 Both checked = 3 Regards, Boyan On Sun, Feb 26, 2012 at 7:59 PM, euromark wrote: > seems like exactly the thing I did the last couple of days: > http://www.dereuromark.de/2012/02/26/bitmasked-using-bitmasks-in-cakephp/ > although I used real bitmasks (integer)^^ > > for the view you should then use a "multiple checkbox" form field > > > > On 26 Feb., 13:29, Boyan Penev wrote: > > Hello, > > > > I would like to accomplish the following: out of 2 checkboxes, if only > the > > first one is clicked, the value would be 10, if only the second one- 01, > if > > both - 11. I tried giving the checkboxes the same name(array) attribute > and > > different values, like: > > $this->Form->input('example', array('type' => 'checkbox', 'name' => > > 'checked[]', 'value' => 1) > > and i get an indexed array over which i need to iterate in the > controller. > > Does anyone have an idea, how could i map the values directly in the > view, > > in order for the controller to receive the final result? > > > > Thanks, > > > > Boyan > > -- > Our newest site for the community: CakePHP Video Tutorials > http://tv.cakephp.org > Check out the new CakePHP Questions site http://ask.cakephp.org and help > others with their CakePHP related questions. > > > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.com For more options, visit this group > at http://groups.google.com/group/cake-php > -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
autocomplete
Hi, I having problem with an autocomplete function. I have a form with a search input. Via jquery I catch the submit function and do a $.post(); to my search controller/action which returns the found data to a view via $this->set(compact('data')); I used this->layout = 'ajax'; And here is my problem. How can I display my template autocomplete.ctp as div within my layout? For now it exits only "behind the scenes". Somehow I need to make it visible... I am just lost in this... -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cakephp Foreach when using Joins
learn something new every day :) On Monday, 27 February 2012 16:46:36 UTC, euromark wrote: > > debug() automatically echoes > so no echo required^^ > > > On 27 Feb., 17:11, phpMagpie wrote: > > echo debug($array); gives much nicer formatting. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Best way to work with MySQL table relations (referential integrity)
Most of the time I want the orphan records to be deleted, as they would have been done by CakePHP (using dependent=>true) if I did not have the MySQL relations in place. It was very rare that I created orphans in my code before using MySQL relations, as I use counterCache a lot and where I did not want to delete a record if it had dependents I would check against the counterCache value. It seems I have potentially took one step forward and two steps back. I value the fact that the database WILL NOT allow me to create orphans as a safety net, but if I have to create extra code to allow me to delete a record and it's dependents, something that was done automatically beforehand, then I think I will be removing the MySQL relations :( -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
well, if I do it like the book says, I get no sql error any more, but the if ($this->Auth->login()) fails without any comment. In this case, how can I get the sql statement debugged which is running? On 28 Feb., 10:33, luca capra wrote: > Il 28/02/2012 09:55, heohni ha scritto: > > > > > > > > > I did this, see above? > > > On 28 Feb., 09:36, "@dariobarila" wrote: > >> Hello, > >> try to configure the Auth fields on the same level of $components = > >> array('Auth'); > > >> On 28 Feb, 09:33, heohni wrote: > >> ... > >>> $this->Auth->fields = array('username' => 'usr_username', > >>> 'password' => 'usr_password'); > >>> $this->Auth->allowedActions = array('display', 'index', > >>> 'add'); > >>> $this->Auth->autoRedirect = false; > >>> $this->Auth->logoutRedirect = array('controller' => > >>> 'bookmark', 'action' => 'search'); > >>> $this->Auth->loginRedirect = array('controller' => 'pages', > >>> 'action' => 'display', 'home'); > >>> } > > >>> ... > >>> SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`, > >>> `User`.`created` FROM `project`.`users` AS `User` WHERE > >>> `User`.`username` = 'me' AND `User`.`password` = > >>> '998992c0dfcffb9ad442a85be2d636ba37228c3d' LIMIT 1 > > I think he means something like (read the book): > > $components = array( > 'Auth' => array( > 'authenticate' => array( > 'Form' => array( > "fields" => array( > 'username' => 'usr_nameuser', > 'password' => 'usr_wordpass' > ), > ) > ), > ); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
Even that way give me the same strange sql error On 28 Feb., 10:33, luca capra wrote: > Il 28/02/2012 09:55, heohni ha scritto: > > > > > > > > > I did this, see above? > > > On 28 Feb., 09:36, "@dariobarila" wrote: > >> Hello, > >> try to configure the Auth fields on the same level of $components = > >> array('Auth'); > > >> On 28 Feb, 09:33, heohni wrote: > >> ... > >>> $this->Auth->fields = array('username' => 'usr_username', > >>> 'password' => 'usr_password'); > >>> $this->Auth->allowedActions = array('display', 'index', > >>> 'add'); > >>> $this->Auth->autoRedirect = false; > >>> $this->Auth->logoutRedirect = array('controller' => > >>> 'bookmark', 'action' => 'search'); > >>> $this->Auth->loginRedirect = array('controller' => 'pages', > >>> 'action' => 'display', 'home'); > >>> } > > >>> ... > >>> SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`, > >>> `User`.`created` FROM `project`.`users` AS `User` WHERE > >>> `User`.`username` = 'me' AND `User`.`password` = > >>> '998992c0dfcffb9ad442a85be2d636ba37228c3d' LIMIT 1 > > I think he means something like (read the book): > > $components = array( > 'Auth' => array( > 'authenticate' => array( > 'Form' => array( > "fields" => array( > 'username' => 'usr_nameuser', > 'password' => 'usr_wordpass' > ), > ) > ), > ); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
Il 28/02/2012 09:55, heohni ha scritto: I did this, see above? On 28 Feb., 09:36, "@dariobarila" wrote: Hello, try to configure the Auth fields on the same level of $components = array('Auth'); On 28 Feb, 09:33, heohni wrote: ... $this->Auth->fields = array('username' => 'usr_username', 'password' => 'usr_password'); $this->Auth->allowedActions = array('display', 'index', 'add'); $this->Auth->autoRedirect = false; $this->Auth->logoutRedirect = array('controller' => 'bookmark', 'action' => 'search'); $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home'); } ... SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`, `User`.`created` FROM `project`.`users` AS `User` WHERE `User`.`username` = 'me' AND `User`.`password` = '998992c0dfcffb9ad442a85be2d636ba37228c3d'LIMIT 1 I think he means something like (read the book): $components = array( 'Auth' => array( 'authenticate' => array( 'Form' => array( "fields" => array( 'username' => 'usr_nameuser', 'password' => 'usr_wordpass' ), ) ), ); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
I did this, see above? On 28 Feb., 09:36, "@dariobarila" wrote: > Hello, > try to configure the Auth fields on the same level of $components = > array('Auth'); > > On 28 Feb, 09:33, heohni wrote: > > > > > > > > > Hi, > > > as I only have to secure one controller, I put this into my > > usersController: > > > class UsersController extends AppController { > > var $name = 'User'; > > var $components = array('Auth'); > > public function beforeFilter() { > > parent::beforeFilter(); > > > $this->Auth->fields = array('username' => 'usr_username', > > 'password' => 'usr_password'); > > $this->Auth->allowedActions = array('display', 'index', > > 'add'); > > $this->Auth->autoRedirect = false; > > $this->Auth->logoutRedirect = array('controller' => > > 'bookmark', 'action' => 'search'); > > $this->Auth->loginRedirect = array('controller' => 'pages', > > 'action' => 'display', 'home'); > > } > > > But when I try to login, I get this sql error: > > > SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`, > > `User`.`created` FROM `project`.`users` AS `User` WHERE > > `User`.`username` = 'me' AND `User`.`password` = > > '998992c0dfcffb9ad442a85be2d636ba37228c3d' LIMIT 1 > > > It looks to me as $this->Auth->fields is just ignored? > > > I went to the book and read about but I couldn't find a hint how else > > to write it. > > Anyone an idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
CakePHP 2.1RC: How to set a custom layout when using ExceptionRenderer
I'm trying to override default behavior of CakePHP when someone hits URLs like http://localhost/SOMETHING_NOT_VALID I added a subclass of ExceptionRenderer and added a missingController() method. That plumbing all works fine and dandy. If I do an echo(), the output comes out just fine. However, I have two questions: How can I use a custom layout? In my missingController() method, I played with setting $this->controller->layout, but nothing happened. I noticed a 200 gets returned now. I still want to have a 404 returned. How can I keep it so that a 404 gets returned? Thanks in advance! :) -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Having issue with AUTH in 2.1
Hello, try to configure the Auth fields on the same level of $components = array('Auth'); On 28 Feb, 09:33, heohni wrote: > Hi, > > as I only have to secure one controller, I put this into my > usersController: > > class UsersController extends AppController { > var $name = 'User'; > var $components = array('Auth'); > public function beforeFilter() { > parent::beforeFilter(); > > $this->Auth->fields = array('username' => 'usr_username', > 'password' => 'usr_password'); > $this->Auth->allowedActions = array('display', 'index', > 'add'); > $this->Auth->autoRedirect = false; > $this->Auth->logoutRedirect = array('controller' => > 'bookmark', 'action' => 'search'); > $this->Auth->loginRedirect = array('controller' => 'pages', > 'action' => 'display', 'home'); > } > > But when I try to login, I get this sql error: > > SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`, > `User`.`created` FROM `project`.`users` AS `User` WHERE > `User`.`username` = 'me' AND `User`.`password` = > '998992c0dfcffb9ad442a85be2d636ba37228c3d' LIMIT 1 > > It looks to me as $this->Auth->fields is just ignored? > > I went to the book and read about but I couldn't find a hint how else > to write it. > Anyone an idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Having issue with AUTH in 2.1
Hi, as I only have to secure one controller, I put this into my usersController: class UsersController extends AppController { var $name = 'User'; var $components = array('Auth'); public function beforeFilter() { parent::beforeFilter(); $this->Auth->fields = array('username' => 'usr_username', 'password' => 'usr_password'); $this->Auth->allowedActions = array('display', 'index', 'add'); $this->Auth->autoRedirect = false; $this->Auth->logoutRedirect = array('controller' => 'bookmark', 'action' => 'search'); $this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home'); } But when I try to login, I get this sql error: SELECT `User`.`usr_id`, `User`.`usr_username`, `User`.`usr_password`, `User`.`created` FROM `project`.`users` AS `User` WHERE `User`.`username` = 'me' AND `User`.`password` = '998992c0dfcffb9ad442a85be2d636ba37228c3d'LIMIT 1 It looks to me as $this->Auth->fields is just ignored? I went to the book and read about but I couldn't find a hint how else to write it. Anyone an idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Cake 2.0.x auth
Thank you Jeremy. My bookmarklet can't post data due to crossdomain restriction, I can only send GET requests with jsonp, so I've writed some code like this: $this->data->["User"]["username"] = $this->request->query["username"]; (some for password) and then passed $this->data to $this->Auth- >login... btw I will make some test and I will update you... meantime I've used $this->User->findByUsernameandPassword to retrieve the actual user (using the auth hashing for passwords) ;) Thank you again On 27 Feb, 16:51, jeremyharris wrote: > There's nothing really out of the ordinary going on here, it's basic Cake > stuff. > > Your ajax form should POST the data to /users/login. Then your controller > action can look something like: > > public function login() { > if ($this->Auth->login($this->data) { > // set flash > // set user data via $this->Auth->user() > > } else { > // set flash > } > } > > You should probably have a json view for this so the Ajax function can > interpret it. > > > > > > > > On Sunday, February 26, 2012 12:55:04 PM UTC-8, @dariobarila wrote: > > > I know this tutorial and coded for learning cake, but there is a lot > > of magic under $this->Auth->login, what I need is to understand of can > > I use username and password retrieved from $this->request to identify > > an user and return user ID to make some business logic... > > > Thank you anyway for your response... > > > On 26 Feb, 19:57, Tilen Majerle wrote: > > >http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp... > > > > -- > > > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > > > 2012/2/26 @dariobarila > > > > > Hi all, > > > > I'm developing a bookmarklet for social shopping, I need to let user > > > > to authenticate trough my bookmarklet via ajax, my idea is to send to > > > > my cakeapp username & password and with a cookie on the browser store > > > > a session after cake has authenticated the user. > > > > > I've tried to grab username & psw trough $this->request->query and > > > > then I set $this->request->data["User"]; > > > > Next I call $this->Auth->login($this->data["User"]) hoping that cake > > > > will authenticate the user and return me the user model with ID and > > > > other fields... > > > > > But it's not working... > > > > > The cakebook is not helping me... :( > > > > > I'm a frontend developer, but a this time I need some backend and I > > > > love Cake. > > > > > Any idea to help me? > > > > > -- > > > > Our newest site for the community: CakePHP Video Tutorials > > > >http://tv.cakephp.org > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > > group > > > > athttp://groups.google.com/group/cake-php > On Sunday, February 26, 2012 12:55:04 PM UTC-8, @dariobarila wrote: > > > I know this tutorial and coded for learning cake, but there is a lot > > of magic under $this->Auth->login, what I need is to understand of can > > I use username and password retrieved from $this->request to identify > > an user and return user ID to make some business logic... > > > Thank you anyway for your response... > > > On 26 Feb, 19:57, Tilen Majerle wrote: > > >http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-examp... > > > > -- > > > Lep pozdrav, Tilen Majerlehttp://majerle.eu > > > > 2012/2/26 @dariobarila > > > > > Hi all, > > > > I'm developing a bookmarklet for social shopping, I need to let user > > > > to authenticate trough my bookmarklet via ajax, my idea is to send to > > > > my cakeapp username & password and with a cookie on the browser store > > > > a session after cake has authenticated the user. > > > > > I've tried to grab username & psw trough $this->request->query and > > > > then I set $this->request->data["User"]; > > > > Next I call $this->Auth->login($this->data["User"]) hoping that cake > > > > will authenticate the user and return me the user model with ID and > > > > other fields... > > > > > But it's not working... > > > > > The cakebook is not helping me... :( > > > > > I'm a frontend developer, but a this time I need some backend and I > > > > love Cake. > > > > > Any idea to help me? > > > > > -- > > > > Our newest site for the community: CakePHP Video Tutorials > > > >http://tv.cakephp.org > > > > Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp > > > > others with their CakePHP related questions. > > > > > To unsubscribe from this group, send email to > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this > > group > > > > athttp://groups.google.com/group/cake-php > On Sunday, February 26, 2012 12:55:04 PM UTC-8, @dariobarila wrote: > > > I know this tutorial and coded for learning cake, but there is a lot > > of magic under $this->Auth->login, what I need is to understand of can > > I use username and password r
Re: Socket Connection exception while attempting to use CakeEmail
You have to install/configure mail server on windows. Or use SMTP like gmail: 'host' => 'ssl://smtp.gmail.com', 'port' => 465, 'username' => 'exam...@gmail.com', 'password' => 'xxx', 'transport' => 'Smtp', - make sure php_openssl is loaded in php.ini On Tuesday, February 28, 2012 3:25:35 AM UTC+1, padma wrote: > > Hi all, > > I am not sure how to fix this socketException while making an > attempt to post an email. Thanks for the help. Do I need to touch > anything in php.ini file. > > CakeLog::write('debug', 'Something did not work'); > $email = new CakeEmail(); > $email->from(array('p_peru...@hotmail.com' => 'My Site')); > $email->to('aart...@yahoo.com'); > $email->subject('First message from Tamil Padam'); > $email->send('Just check this tamil padam site'); > > 2012-02-27 21:03:02 Error: [SocketException] Could not send email. > #0 C:\www\tamilpadam\lib\Cake\Network\Email\CakeEmail.php(967): > MailTransport->send(Object(CakeEmail)) > #1 C:\www\tamilpadam\app\Controller\Firstpagescontroller.php(38): > CakeEmail->send('Just check this...') > #2 [internal function]: Firstpagescontroller->email_myfriend() > #3 C:\www\tamilpadam\lib\Cake\Controller\Controller.php(473): > ReflectionMethod->invokeArgs(Object(Firstpagescontroller), Array) > #4 C:\www\tamilpadam\lib\Cake\Routing\Dispatcher.php(104): Controller- > >invokeAction(Object(CakeRequest)) > #5 C:\www\tamilpadam\lib\Cake\Routing\Dispatcher.php(86): Dispatcher- > >_invoke(Object(Firstpagescontroller), Object(CakeRequest), > Object(CakeResponse)) > #6 C:\www\tamilpadam\app\webroot\index.php(96): Dispatcher- > >dispatch(Object(CakeRequest), Object(CakeResponse)) > #7 {main} -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php