Re: Cakephp 2.x Receive emails into the application...
This might help you https://github.com/barbushin/php-imap Am Samstag, 12. März 2016 01:31:18 UTC+1 schrieb April DeRossett: > > Ahoy! I am looking for a way to receive reply emails into my cakephp > application and after a ton of research I haven't yet figured out how to > make that happen. Pretend I am an awesome PHP and MySQL programmer but, > that I know Nothing about managing an email server. Does anyone know of a > great tutorial or read that would help me get started? Thanks in advance. > April > -- Sign up for our Newsletter for updates. http://cakephp.org/newsletter/signup We will soon be closing this Google Group. But don't worry, we have something better coming. Stay tuned for an updated from the CakePHP Team soon. Like Us on FaceBook https://www.facebook.com/CakePHP Follow us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Cakephp 2.x ajax edit not working in Firefox and Opera
im also having this kind of problem. does anyone know what's wrong with this one? On Friday, September 14, 2012 6:23:05 AM UTC+8, incognito wrote: Hi, I am basically trying to create an ajax edit form. This is the edit link code ?= $this-Js-link('Edit', array('controller' = 'employees', 'action' = 'personal_details_edit',$employee['Employee']['id']), array( 'update' = '#personal_details_update', 'evalScripts' = true, 'before' = $this-Js-get('#busy-indicator')-effect('fadeIn', array('buffer' = false)), 'complete' = $this-Js-get('#busy-indicator')-effect('fadeOut', array('buffer' = false)), ) ); echo $this-Js-writeBuffer(); ? And this is the ajax form code which gets loaded after clicking the above edit link. ? //serialize the form element to submit $data = $this-Js-get('#employee_personal_edit')-serializeForm( array( 'isForm' = true, 'inline' = true) ); // Submit the serialize data on submit click $this-Js-get('#employee_personal_edit')-event( 'submit', $this-Js-request( array('action' = 'personal_details_edit'), array( 'update' = '#personal_details_update', // element to update // after form submission 'data' = $data, 'async' = true, 'dataExpression'=true, 'method' = 'POST', ) ) ); echo $this-Js-writeBuffer(); ? The form submit is working in Chrome, IE, Safari but not working in Firefox and Opera.When I click form submit in Firefox nothing happens(no XMLHTTPRequest is being sent). If i access the form link directly(without loading via ajax edit link)its working normally in Firefox. How to fix it?Any help is appreciated. :) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePHP 2.x running on Lighttpd
Did you found any solution for that? Τη Δευτέρα, 11 Νοεμβρίου 2013 2:35:16 μ.μ. UTC+2, ο χρήστης Riccardo Trombini έγραψε: Hi Did someone successfully manage to run CakePHP 2.x on a lighttp server? I am having troubles accessing javascript and css-files. I run into an error 404. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePHP 2.x Date Field Helper set year?
the rule stays the same, you just apply a different start value to check against. TODAY is the same as $startValue for your custom validation method anyway Am Mittwoch, 7. August 2013 20:06:50 UTC+2 schrieb Eric Haskins: Hey everyone quick question. I have an app and Im having issues with Users setting birthdates to 2013-12-13 as an example. I know I should have a validator to make sure it isnt a future date but is there a way to seed the start year say 4 years ago? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePHP 2.x Moving Find into Model
Apply the array to the $paginate class var, not the method. Basically, you can declare the $paginate array as a class var, then add to or override any part of it from within an action. On Thu, May 23, 2013 at 7:12 PM, Larry Lutz lut...@swbell.net wrote: I'm trying to achieve the fat model/skinny controller mantra in CakePHP 2.7. In that scenario, the model should control the data, and that means moving the finds out of the controllers and into the models. However, at least with the view and admin_view actions, one needs the data paginated. The problem starts there. It's easy enough to do a $this-find('all') in the model to get the data, along with any conditions, contains, etc. However that produces an array. Paginator-paginate(), as far as I can tell won't work in the model; it's a component that only works in a controller. Yet, if I take the array produced in the model into the controller and try to pass it on to Paginator-paginate(), it fails because paginate won't accept an array. In terms of trying to achieve the fat model/skinny controller goal, what am I missing here. How can I achieve a paginated result while still having the model (properly) do the work of managing and finding the data? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePHP 2.x Moving Find into Model
Have you got an example of that? On 24 May 2013, at 01:09, lowpass zijn.digi...@gmail.com wrote: Apply the array to the $paginate class var, not the method. Basically, you can declare the $paginate array as a class var, then add to or override any part of it from within an action. On Thu, May 23, 2013 at 7:12 PM, Larry Lutz lut...@swbell.net wrote: I'm trying to achieve the fat model/skinny controller mantra in CakePHP 2.7. In that scenario, the model should control the data, and that means moving the finds out of the controllers and into the models. However, at least with the view and admin_view actions, one needs the data paginated. The problem starts there. It's easy enough to do a $this-find('all') in the model to get the data, along with any conditions, contains, etc. However that produces an array. Paginator-paginate(), as far as I can tell won't work in the model; it's a component that only works in a controller. Yet, if I take the array produced in the model into the controller and try to pass it on to Paginator-paginate(), it fails because paginate won't accept an array. In terms of trying to achieve the fat model/skinny controller goal, what am I missing here. How can I achieve a paginated result while still having the model (properly) do the work of managing and finding the data? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
RE: CakePHP 2.x Moving Find into Model
Not sure if this is any help. But I hate all the $params in the controller especially if you have to do it on the fly so I set all the params in the model like such: (Just swap out 'model' for your own ) Model: public function _Pagination($limit = 15){ $params = array( 'conditions' = array( 'fields' = array( 'Model.id', 'Model.featured', 'Model.title', 'Model.description), 'limit' = $limit, 'order' = array( 'Model.created DESC'), 'contain' = array( 'State' = array( 'fields' = array( 'State.abrev')), 'Country' = array( 'fields' = array( 'Country.name', 'Country.iso'))); return $params; } Controller: $this-paginate = $this-Model-_Pagination ($anything you want to pass $limit, $conditions...); And just pop it into the find into the $params like $this-paginate = $this-Model-_Pagination($limit = 10); or anything you might want to edit on the fly. Swap out all the vars you want and make it work for you. Then do standard: $this-set('whatever', $this-paginate('Model')); All it is basically is the same as you normally would do in the controller but rather than having all that crap I find it easier to say paginateThis(), pagginateThat() rather than all that in the controller and just pull the params from the model. Dave From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Jeremy Burns : Class Outfit Sent: Friday, May 24, 2013 1:00 AM To: cake-php@googlegroups.com Subject: Re: CakePHP 2.x Moving Find into Model Have you got an example of that? On 24 May 2013, at 01:09, lowpass zijn.digi...@gmail.com wrote: Apply the array to the $paginate class var, not the method. Basically, you can declare the $paginate array as a class var, then add to or override any part of it from within an action. On Thu, May 23, 2013 at 7:12 PM, Larry Lutz lut...@swbell.net wrote: I'm trying to achieve the fat model/skinny controller mantra in CakePHP 2.7. In that scenario, the model should control the data, and that means moving the finds out of the controllers and into the models. However, at least with the view and admin_view actions, one needs the data paginated. The problem starts there. It's easy enough to do a $this-find('all') in the model to get the data, along with any conditions, contains, etc. However that produces an array. Paginator-paginate(), as far as I can tell won't work in the model; it's a component that only works in a controller. Yet, if I take the array produced in the model into the controller and try to pass it on to Paginator-paginate(), it fails because paginate won't accept an array. In terms of trying to achieve the fat model/skinny controller goal, what am I missing here. How can I achieve a paginated result while still having the model (properly) do the work of managing and finding the data? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com mailto:cake-php%2bunsubscr...@googlegroups.com . To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop
Re: CakePHP 2.x Moving Find into Model
Got it - thanks. So you're really just setting up the paginate variable in the model rather than the controller then calling it from the controller to set up pagination before doing a paginate find? On 24 May 2013, at 05:25, Advantage+ movepix...@gmail.com wrote: Not sure if this is any help. But I hate all the $params in the controller especially if you have to do it on the fly so I set all the params in the model like such: (Just swap out 'model' for your own ) Model: public function _Pagination($limit = 15){ $params = array( 'conditions' = array( 'fields' = array( 'Model.id', 'Model.featured', 'Model.title', 'Model.description), 'limit' = $limit, 'order' = array( 'Model.created DESC'), 'contain' = array( 'State' = array( 'fields' = array( 'State.abrev')), 'Country' = array( 'fields' = array( 'Country.name', 'Country.iso'))); return $params; } Controller: $this-paginate = $this-Model-_Pagination ($anything you want to pass $limit, $conditions…….); And just pop it into the find into the $params like $this-paginate = $this-Model-_Pagination($limit = 10); or anything you might want to edit on the fly. Swap out all the vars you want and make it work for you. Then do standard: $this-set('whatever', $this-paginate('Model')); All it is basically is the same as you normally would do in the controller but rather than having all that crap I find it easier to say paginateThis(), pagginateThat() rather than all that in the controller and just pull the params from the model. Dave From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Jeremy Burns : Class Outfit Sent: Friday, May 24, 2013 1:00 AM To: cake-php@googlegroups.com Subject: Re: CakePHP 2.x Moving Find into Model Have you got an example of that? On 24 May 2013, at 01:09, lowpass zijn.digi...@gmail.com wrote: Apply the array to the $paginate class var, not the method. Basically, you can declare the $paginate array as a class var, then add to or override any part of it from within an action. On Thu, May 23, 2013 at 7:12 PM, Larry Lutz lut...@swbell.net wrote: I'm trying to achieve the fat model/skinny controller mantra in CakePHP 2.7. In that scenario, the model should control the data, and that means moving the finds out of the controllers and into the models. However, at least with the view and admin_view actions, one needs the data paginated. The problem starts there. It's easy enough to do a $this-find('all') in the model to get the data, along with any conditions, contains, etc. However that produces an array. Paginator-paginate(), as far as I can tell won't work in the model; it's a component that only works in a controller. Yet, if I take the array produced in the model into the controller and try to pass it on toPaginator-paginate(), it fails because paginate won't accept an array. In terms of trying to achieve the fat model/skinny controller goal, what am I missing here. How can I achieve a paginated result while still having the model (properly) do the work of managing and finding the data? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group
RE: CakePHP 2.x Moving Find into Model
Yeah just to keep it simple but allow to pass vars if needed. Just an example what I sent but you can pop wars in everything condition you want based on the controller action. I have some if logged in page based on viewed / like / hate.. Its limitless. So define the core structure and just simply swap out as needed From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Jeremy Burns : Class Outfit Sent: Friday, May 24, 2013 2:01 AM To: cake-php@googlegroups.com Subject: Re: CakePHP 2.x Moving Find into Model Got it - thanks. So you're really just setting up the paginate variable in the model rather than the controller then calling it from the controller to set up pagination before doing a paginate find? On 24 May 2013, at 05:25, Advantage+ movepix...@gmail.com wrote: Not sure if this is any help. But I hate all the $params in the controller especially if you have to do it on the fly so I set all the params in the model like such: (Just swap out 'model' for your own ) Model: public function _Pagination($limit = 15){ $params = array( 'conditions' = array( 'fields' = array( 'Model.id', 'Model.featured', 'Model.title', 'Model.description), 'limit' = $limit, 'order' = array( 'Model.created DESC'), 'contain' = array( 'State' = array( 'fields' = array( 'State.abrev')), 'Country' = array( 'fields' = array( 'Country.name', 'Country.iso'))); return $params; } Controller: $this-paginate = $this-Model-_Pagination ($anything you want to pass $limit, $conditions...); And just pop it into the find into the $params like $this-paginate = $this-Model-_Pagination($limit = 10); or anything you might want to edit on the fly. Swap out all the vars you want and make it work for you. Then do standard: $this-set('whatever', $this-paginate('Model')); All it is basically is the same as you normally would do in the controller but rather than having all that crap I find it easier to say paginateThis(), pagginateThat() rather than all that in the controller and just pull the params from the model. Dave From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf Of Jeremy Burns : Class Outfit Sent: Friday, May 24, 2013 1:00 AM To: cake-php@googlegroups.com Subject: Re: CakePHP 2.x Moving Find into Model Have you got an example of that? On 24 May 2013, at 01:09, lowpass mailto:zijn.digi...@gmail.com zijn.digi...@gmail.com wrote: Apply the array to the $paginate class var, not the method. Basically, you can declare the $paginate array as a class var, then add to or override any part of it from within an action. On Thu, May 23, 2013 at 7:12 PM, Larry Lutz mailto:lut...@swbell.net lut...@swbell.net wrote: I'm trying to achieve the fat model/skinny controller mantra in CakePHP 2.7. In that scenario, the model should control the data, and that means moving the finds out of the controllers and into the models. However, at least with the view and admin_view actions, one needs the data paginated. The problem starts there. It's easy enough to do a $this-find('all') in the model to get the data, along with any conditions, contains, etc. However that produces an array. Paginator-paginate(), as far as I can tell won't work in the model; it's a component that only works in a controller. Yet, if I take the array produced in the model into the controller and try to pass it on toPaginator-paginate(), it fails because paginate won't accept an array. In terms of trying to achieve the fat model/skinny controller goal, what am I missing here. How can I achieve a paginated result while still having the model (properly) do the work of managing and finding the data? -- Like Us on FaceBook https://www.facebook.com/CakePHP https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to mailto:cake-php%2bunsubscr...@googlegroups.com cake-php+unsubscr...@googlegroups.com. To post to this group, send email to mailto:cake-php@googlegroups.com cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP http://twitter.com/CakePHP --- You received this message because you are subscribed
Re: CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?
Hi Kicaj and thanks for your post, I stumbled upon it before to start the internationalization of project. It was helpful but my main problem is that I can't save data with validation, I have to turn them off on my save($data,false) and I can't figure why it won't work! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePhp 2.x - Internationalization/Localization/Translate Behavior/i18n - How to use in 2.x?
Read my article on bakery site: http://bakery.cakephp.org/articles/kicaj/2013/01/27/internationalization_with_static_and_dynamic_content_routing_and_switching W dniu wtorek, 2 kwietnia 2013 05:06:25 UTC+2 użytkownik Livin Inchina napisał: Hi everyone! I'm having a hard time making my website multilingual and I after going through the net seeking for answers, I found out that I wasn't the first one to have these issues with version 2.x. I'm trying to translate my blog. So I have a Post.php model, a PostsController.php and a view admin_edit.ctp. Using the console, I've created the i18n table by hitting the command cake i18n. Following are my files: *bootstrap.php* Configure::write('Config.languages', array('fra','eng')); Configure::write('Config.language','fra'); * * *Post.php* ?php class Post extends AppModel{ public $actsAs = array( 'Translate' = array( 'name'= '_name', 'slug'= '_slug', 'content' = '_content' ) ); } *PostsController.php* * * function admin_edit($id=null){ if (!empty($this-request-data)) { $this-Post-create(); $this-Post-locale = Configure::read('Config.languages'); if (!empty($this-request-data['Post']['file']['name']) !empty($this-request-data['Post']['photo'])) { $dir = IMAGES.'news'; if (!file_exists($dir)) { mkdir($dir,0777); } $photo = preg_replace('~[^\w-\.]~', '-', strtolower($this-request-data['Post']['photo']['fra'])); $f = explode('.',$this-request-data['Post']['file']['name']); $ext = '.'.end($f); $filename = $photo.date('-YmdHis'); move_uploaded_file($this-request-data['Post']['file']['tmp_name'], $dir.DS.$filename.$ext); } if ($this-Post-save($this-request-data, false)) { debug($this-request-data); // $this-redirect(array('action' = 'admin_index')); } if ($id!=null) { $this-Post-id = $id; $this-request-data = $this-Post-readAll(); } } } *admin_edit.ctp* * * ?php echo $this-Form-create('Post', array('type' = 'file')); echo $this-Form-input('file', array('type' = 'file')); echo $this-Form-input('photo', array(); foreach (Configure::read('Config.languages') as $lang): echo $this-Form-input('Post.name.'.$lang, array('div' = false, 'label' = false)); echo $this-Form-input('Post.slug.'.$lang, array('div' = false, 'label' = false)); echo $this-Form-textarea('Post.content.'.$lang, array('div' = false, 'label' = false)); endforeach; echo $this-Form-input('id'); echo $this-Form-hidden('created'); echo $this-Form-end('done'); ? -- You will notice that in my controller I use $this-Post-locale = Configure::read('Config.languages'); to save all my languages at once. To do that, I also loop my input in the view foreach (Configure::read('Config.languages') as $lang): This code is working as it but it's not enough. As you can see I have a picture and I would like to insert its name in the posts table. Right now, if I want to save the name of the picture, I have to do like that: my-image.jpg, meaning I have to manually format it in the form. Also, I have a slug and to create it I would like to use the name field and add - instead of the spaces to format my slug. With my code above, I just do a simple $this-Post-save($this-request-data, false) but I cannot format my data. What I'd like to do is something like that for example: $success = array( 'name'= $name, 'slug'= $slug, 'photo' = $photo, 'content' = $content, 'id' = $id ); $this-Post-save($success,false); The problem when I do that is that it needs to be saved in as many languages as I have because. When I loop it to save all the languages, everything is save in the i18n table, all the values are translated, the only problem is that the locale column data are all the same, the locale that has been used when saved. By the way, you will notice that I disabled the validation in the second parameter of the save. If I don't do that, nothing happens. That's one of the problem I can't figure, why couldn't I do validations? So my questions are, how can I save my data in both tables i18n and posts with the possibility to format the data before saving? How come I have to disable the validation to make the saving work? If you already done that on V2.x, how did you do it? I'm really stuck on this, the only solution I have right now is no validations, and format data manually in the form. This is really not convenient and not pro. I really hope somebody will help me, I've posted this problem in every forum and group I know, and nobody answered me yet. Help for a desperate guy... Thank you very very much for your help! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com.
Re: Cakephp 2.x - Changing the name of a table within the schema
Not sure if it is possible using the core CakePHP schema tool. If I was to attempt this, I would investigate what events are sent to the before() method. If you find something that works. Then run ClassRegistry::init('Model')-query('RENAME ...'). Take a look at how I pre-populated a user table after I created it: https://gist.github.com/sime/1917192 I must say I religiously used the schema tool for migrations, until I discovered the Migrations plugin by CakeDC. On Fri, Feb 15, 2013 at 3:43 AM, fr3nch13 fr3nc...@gmail.com wrote: Is there a way to change the name of a table (tables) within the database schema? reference: (http://book.cakephp.org/2.0/en/console-and-shells/schema-management-and-migrations.html) I was unable to find out how to do this via googling, or searching the api/book. Basically this is what I'm trying to do: 1. I have a table named say 'cars'. I want to change the table name to 'vehicles'. 2. I would like to be able to do this within the built in schema. 3. I don't want to drop the old table and create a new one. The only way have come up with to do this would be to do something in the before() function. and do something like this: http://dev.mysql.com/doc/refman/5.0/en/rename-table.html I haven't tested this idea as I don't want to actually change anything. Is this the only way? Will cakephp recognize the change instead of resorting to looking at it's own cache? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Simon Males -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: CakePHP 2.x and ajax
http://www.cakephp.4uk.pl On Thursday, November 1, 2012 4:18:57 PM UTC+8, franscelstain wrote: is there someone who can teach me to use ajax in cakephp 2.x, because I am still very novice thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x and ajax
The ajax helper is deprecated in 2.0. Here's a quick and dirty ajax form submission: in app_controller-beforeFilter(): if ($this-RequestHandler-isAjax()) { Configure::write('debug', 0); $this-autoRender = false; $this-layout = 'ajax'; } In the head section of default layout: script var baseUrl = ?php echo $this-Html-url('/', true); ?; /script At the end of the controller function (after all variables have been set): if ($this-RequestHandler-isAjax()) { $this-render('/elements/[element name]); } At the foot of the form containing the form to submit via ajax (or in an external js file that's called with $this-Html-script): script $('#[FORM_NAME]').submit(function() { $.ajax({ type: 'POST', url: baseUrl + '[ROUTE]', - note that baseUrl has a following / so no need to put one in from of [ROUTE] data: $(this).serialize(), dataType: 'html', success: function(data){ $('#[id of receiving content]').fadeOut(100, function() { $(this).html(data).fadeIn(500); }); }, error: function(message){ console.debug(message); } }); return false; }); /script And that's it!! On 4 Nov 2012, at 06:59, kani infok...@gmail.com wrote: http://www.cakephp.4uk.pl On Thursday, November 1, 2012 4:18:57 PM UTC+8, franscelstain wrote: is there someone who can teach me to use ajax in cakephp 2.x, because I am still very novice thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x and ajax
Checkout this video: http://www.youtube.com/watch?v=dQ71psonQx0feature=plcp. Hope it helps. On Thursday, 1 November 2012 04:18:57 UTC-4, franscelstain wrote: is there someone who can teach me to use ajax in cakephp 2.x, because I am still very novice thanks -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x implement edit form in ajax in a popup
Hi, You are use facebox jquery this is very nice On Wednesday, October 3, 2012 10:00:22 AM UTC-4, Kiran wrote: I have read other posts and searched google before posting this here. I have a jquery popup in a view where I intend to show EDIT form and then submit using ajax. Further Details There is a reservation controller. reservations on a particular date are shown in the index ctp in a table . When user clicks on edit button a div pops up. Now I need to show Edit form and submit it via Ajax. Please can somebody point me in the right direction , may be some help or some tutorial. Thanks in advance, Kiran -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x how to manage multiple user-tables and access areas?
Actually you only need one table with the following fields: username or email password group + additional fields that might be useful for your application After login (with AuthComponent) you can check to which group the user belongs. Depending on the group you can redirect the user to the correct area. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x implement edit form in ajax in a popup
You can find solution inside code down here, just read it carefuly. I used fancybox, but easily you can use some other functions from jquery. I recommend you fancybox for this kind of action. div class=add-feedback a class=rize-feedback buttonb href=#feedback-form-div?php __('Submit feedback'); ?/a div class=feedbacks id=feedback-form-div style=display:none; h2?php __('Feedback'); ?/h2 ?php echo $this-Form-create('Feedback', array('id' = 'feedback-form', 'controller' = 'feedbacks', 'action' = 'add'));? label for=rate-value?php __('Rate this ride'); ?/label ?php echo $this-Form-input('rate', array('type' = 'hidden', 'id' = 'rate-value')); ? div class=star/div ?php echo $this-Form-input('ride_id', array('type' = 'hidden', 'value' = $ride['Ride']['id'])); ? ?php echo $this-Form-input('comment', array('type' = 'textfield')); ? ?php echo $this-Form-end(__('Submit', true));? /div /div script type=text/javascript $(document).ready(function() { $(.rize-feedback).fancybox({ fitToView : false, width : '70%', height : '70%', autoSize : true, closeClick : false, openEffect : 'none', closeEffect : 'none' }); $('.star').raty({ cancel : true, target : '#rate-value', targetKeep : true, targetType : 'number' }); $(#feedback-form).submit(function(){ $.fancybox.showLoading(); $.ajax({ type: POST, url: $(this).attr('action'), data: $(#feedback-form).serialize(), }).done(function( msg ) { $.fancybox.hideLoading(); json = jQuery.parseJSON(msg); $('#feedback-form').hide(); $('#feedback-form-div h2').text(json.Success.title); $('#feedback-form-div').append('p class=pop-success' + json.Success.message + '/p'); }); return false; }) }) /script -- *Ivan Rimac*** mail: ivn...@gmail.com *tel: +385 95 555 99 66* *http://ivanrimac.com* -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x implement edit form in ajax in a popup
Thank you very much Ivan, I got an Idea now. I tried similarly but couldnt get it worked and thought that was not the right way. It is clear now. I will try this and post my results here. Cheers, Kiran On Thu, Oct 4, 2012 at 11:46 AM, Ivan Rimac ivn...@gmail.com wrote: You can find solution inside code down here, just read it carefuly. I used fancybox, but easily you can use some other functions from jquery. I recommend you fancybox for this kind of action. div class=add-feedback a class=rize-feedback buttonb href=#feedback-form-div?php __('Submit feedback'); ?/a div class=feedbacks id=feedback-form-div style=display:none; h2?php __('Feedback'); ?/h2 ?php echo $this-Form-create('Feedback', array('id' = 'feedback-form', 'controller' = 'feedbacks', 'action' = 'add'));? label for=rate-value?php __('Rate this ride'); ?/label ?php echo $this-Form-input('rate', array('type' = 'hidden', 'id' = 'rate-value')); ? div class=star/div ?php echo $this-Form-input('ride_id', array('type' = 'hidden', 'value' = $ride['Ride']['id'])); ? ?php echo $this-Form-input('comment', array('type' = 'textfield')); ? ?php echo $this-Form-end(__('Submit', true));? /div /div script type=text/javascript $(document).ready(function() { $(.rize-feedback).fancybox({ fitToView : false, width : '70%', height : '70%', autoSize : true, closeClick : false, openEffect : 'none', closeEffect : 'none' }); $('.star').raty({ cancel : true, target : '#rate-value', targetKeep : true, targetType : 'number' }); $(#feedback-form).submit(function(){ $.fancybox.showLoading(); $.ajax({ type: POST, url: $(this).attr('action'), data: $(#feedback-form).serialize(), }).done(function( msg ) { $.fancybox.hideLoading(); json = jQuery.parseJSON(msg); $('#feedback-form').hide(); $('#feedback-form-div h2').text(json.Success.title); $('#feedback-form-div').append('p class=pop-success' + json.Success.message + '/p'); }); return false; }) }) /script -- *Ivan Rimac*** mail: ivn...@gmail.com *tel: +385 95 555 99 66* *http://ivanrimac.com* -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- *Thank you,* *Kiran.* -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x implement edit form in ajax in a popup
jquery, and $.load() will be your friend here. You can just load the html view of the edit form into a div and show it. not the only way to do it, but certainly the most straight forward. (then just trap the submit, serialize the form, fire off a post in jquery and close the popup, refresh the content) On Thu, Oct 4, 2012 at 12:00 AM, Kiran kiran00...@gmail.com wrote: I have read other posts and searched google before posting this here. I have a jquery popup in a view where I intend to show EDIT form and then submit using ajax. Further Details There is a reservation controller. reservations on a particular date are shown in the index ctp in a table . When user clicks on edit button a div pops up. Now I need to show Edit form and submit it via Ajax. Please can somebody point me in the right direction , may be some help or some tutorial. Thanks in advance, Kiran -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: CakePHP 2.x implement edit form in ajax in a popup
Thanks for your reply Greg. If I had to close the pop up , your solution might work. But I should not close the pop up on submit. That is why I want to do that in Ajax. How can $load pick form which is not on the page. However I am able to display form. I need to know how to submit this form in ajax way.. Many thanks, Kiran On Thu, Oct 4, 2012 at 6:06 AM, Greg Skerman gsker...@gmail.com wrote: jquery, and $.load() will be your friend here. You can just load the html view of the edit form into a div and show it. not the only way to do it, but certainly the most straight forward. (then just trap the submit, serialize the form, fire off a post in jquery and close the popup, refresh the content) On Thu, Oct 4, 2012 at 12:00 AM, Kiran kiran00...@gmail.com wrote: I have read other posts and searched google before posting this here. I have a jquery popup in a view where I intend to show EDIT form and then submit using ajax. Further Details There is a reservation controller. reservations on a particular date are shown in the index ctp in a table . When user clicks on edit button a div pops up. Now I need to show Edit form and submit it via Ajax. Please can somebody point me in the right direction , may be some help or some tutorial. Thanks in advance, Kiran -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. -- *Thank you,* *Kiran.* -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Cakephp 2.x best practice when adding/editing content?
i use a single method, add/edit even if is user or admin, the difference between add/edit is that on edit you have the ID set, or in parameter or in $this-data admin_editpost($id = null){ if(is_null($id){ //something } } i guess you understand vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris: Hi all.. I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x and I am wondering, what are the best practices for the new framework? AND YES, I have read the documents/book :) I am just wondering how you do it, so I can compare my work and see if I am heading in the right direction with my app. So if anyone could give me an idea about a couple simple add/edit functions, and how the best practice for this, I would appreciate it :) like: admin_users_add() { } admin_users_edit() { } and other regular functions you might have an example for. Thanks all! Awesome! -Tom -- 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.x best practice when adding/editing content?
Yes, I understand what you are doing :) Have a couple of those myself.. But my question is (perhaps not clear enough), the best practice for a function like add and edit. I am thinking about: if ($this-request-is('post')) { $this-User-set($this-request-data); if ($this-User-validates()) { Those things inside the function. Like,, what approach/setup would you use on cake 2.x to talk with the db and make things happen :) I am just wondering if I am doing it 100% correct, as I can not find any good tutorials on it anywhere.. Here is my add function as is today, any pointers? public function admin_add() { $this-set('title_for_layout', __('Add new role',true)); if ($this-request-is('post')) { $this-Role-set($this-request-data); if ($this-Role-validates()) { if ($this-Role-save($this-request-data)) { $this-Session-setFlash(__('New role created.',true), 'admin/flash/success'); $this-redirect(array('action' = 'index')); } else { $this-Session-setFlash(__('Could not create role, please try again.',true), 'admin/flash/error'); } } else { // Didn't validate } } $this-set('errors', $this-Role-validationErrors); } -Tom kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende: i use a single method, add/edit even if is user or admin, the difference between add/edit is that on edit you have the ID set, or in parameter or in $this-data admin_editpost($id = null){ if(is_null($id){ //something } } i guess you understand vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris: Hi all.. I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x and I am wondering, what are the best practices for the new framework? AND YES, I have read the documents/book :) I am just wondering how you do it, so I can compare my work and see if I am heading in the right direction with my app. So if anyone could give me an idea about a couple simple add/edit functions, and how the best practice for this, I would appreciate it :) like: admin_users_add() { } admin_users_edit() { } and other regular functions you might have an example for. Thanks all! Awesome! -Tom -- 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.x best practice when adding/editing content?
for starters, take out the validation redundancy why setting the errors to the view? also not necessary also, in 2.x your __() looks differently (arguments usually are not true but replacement strings) why dont you use baking? it would display a better output than you currently have Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ: Yes, I understand what you are doing :) Have a couple of those myself.. But my question is (perhaps not clear enough), the best practice for a function like add and edit. I am thinking about: if ($this-request-is('post')) { $this-User-set($this-request-data); if ($this-User-validates()) { Those things inside the function. Like,, what approach/setup would you use on cake 2.x to talk with the db and make things happen :) I am just wondering if I am doing it 100% correct, as I can not find any good tutorials on it anywhere.. Here is my add function as is today, any pointers? public function admin_add() { $this-set('title_for_layout', __('Add new role',true)); if ($this-request-is('post')) { $this-Role-set($this-request-data); if ($this-Role-validates()) { if ($this-Role-save($this-request-data)) { $this-Session-setFlash(__('New role created.',true), 'admin/flash/success'); $this-redirect(array('action' = 'index')); } else { $this-Session-setFlash(__('Could not create role, please try again.',true), 'admin/flash/error'); } } else { // Didn't validate } } $this-set('errors', $this-Role-validationErrors); } -Tom kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende: i use a single method, add/edit even if is user or admin, the difference between add/edit is that on edit you have the ID set, or in parameter or in $this-data admin_editpost($id = null){ if(is_null($id){ //something } } i guess you understand vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris: Hi all.. I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x and I am wondering, what are the best practices for the new framework? AND YES, I have read the documents/book :) I am just wondering how you do it, so I can compare my work and see if I am heading in the right direction with my app. So if anyone could give me an idea about a couple simple add/edit functions, and how the best practice for this, I would appreciate it :) like: admin_users_add() { } admin_users_edit() { } and other regular functions you might have an example for. Thanks all! Awesome! -Tom -- 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.x best practice when adding/editing content?
Hi Mark.. - Setting validation errors to view to display them in an element = You need to correct: Error message 1, Error message 2, Error message 3 = Need it ;) - __('some text', true) = For translation strings, not sure why I started to use the TRUE, but I think it is because of not beeing able to only have __('some text') inside the strings (Suggestion??) And for the validation Redundancy ? what exactly do you mean? I am validating in models = and pushing messages to the view (not using the error = true on my form fields, all are set to false and display the validation messages in element as explained before. And regarding baking.. Have never used it.. =) Any good tutorials on it? I need to use terminal right? I am developing on my development VPS server, not local, but have terminal access.. Thanks for your time! -Tom kl. 20:05:19 UTC+2 fredag 3. august 2012 skrev euromark følgende: for starters, take out the validation redundancy why setting the errors to the view? also not necessary also, in 2.x your __() looks differently (arguments usually are not true but replacement strings) why dont you use baking? it would display a better output than you currently have Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ: Yes, I understand what you are doing :) Have a couple of those myself.. But my question is (perhaps not clear enough), the best practice for a function like add and edit. I am thinking about: if ($this-request-is('post')) { $this-User-set($this-request-data); if ($this-User-validates()) { Those things inside the function. Like,, what approach/setup would you use on cake 2.x to talk with the db and make things happen :) I am just wondering if I am doing it 100% correct, as I can not find any good tutorials on it anywhere.. Here is my add function as is today, any pointers? public function admin_add() { $this-set('title_for_layout', __('Add new role',true)); if ($this-request-is('post')) { $this-Role-set($this-request-data); if ($this-Role-validates()) { if ($this-Role-save($this-request-data)) { $this-Session-setFlash(__('New role created.',true), 'admin/flash/success'); $this-redirect(array('action' = 'index')); } else { $this-Session-setFlash(__('Could not create role, please try again.',true), 'admin/flash/error'); } } else { // Didn't validate } } $this-set('errors', $this-Role-validationErrors); } -Tom kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende: i use a single method, add/edit even if is user or admin, the difference between add/edit is that on edit you have the ID set, or in parameter or in $this-data admin_editpost($id = null){ if(is_null($id){ //something } } i guess you understand vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris: Hi all.. I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x and I am wondering, what are the best practices for the new framework? AND YES, I have read the documents/book :) I am just wondering how you do it, so I can compare my work and see if I am heading in the right direction with my app. So if anyone could give me an idea about a couple simple add/edit functions, and how the best practice for this, I would appreciate it :) like: admin_users_add() { } admin_users_edit() { } and other regular functions you might have an example for. Thanks all! Awesome! -Tom -- 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.x best practice when adding/editing content?
Validation redundancy. When save is called, the data passed to it in the first parameter is validated using CakePHP validation mechanism. Read more on Models - Saving your data. Also, the validation errors are already available to the view so no need to set them. Try bake and see what it does to get a better feel of the cake way. Gary On Fri, Aug 3, 2012 at 1:43 PM, MetZ met...@gmail.com wrote: Hi Mark.. - Setting validation errors to view to display them in an element = You need to correct: Error message 1, Error message 2, Error message 3 = Need it ;) - __('some text', true) = For translation strings, not sure why I started to use the TRUE, but I think it is because of not beeing able to only have __('some text') inside the strings (Suggestion??) And for the validation Redundancy ? what exactly do you mean? I am validating in models = and pushing messages to the view (not using the error = true on my form fields, all are set to false and display the validation messages in element as explained before. And regarding baking.. Have never used it.. =) Any good tutorials on it? I need to use terminal right? I am developing on my development VPS server, not local, but have terminal access.. Thanks for your time! -Tom kl. 20:05:19 UTC+2 fredag 3. august 2012 skrev euromark følgende: for starters, take out the validation redundancy why setting the errors to the view? also not necessary also, in 2.x your __() looks differently (arguments usually are not true but replacement strings) why dont you use baking? it would display a better output than you currently have Am Freitag, 3. August 2012 17:43:52 UTC+2 schrieb MetZ: Yes, I understand what you are doing :) Have a couple of those myself.. But my question is (perhaps not clear enough), the best practice for a function like add and edit. I am thinking about: if ($this-request-is('post')) { $this-User-set($this-request-data); if ($this-User-validates()) { Those things inside the function. Like,, what approach/setup would you use on cake 2.x to talk with the db and make things happen :) I am just wondering if I am doing it 100% correct, as I can not find any good tutorials on it anywhere.. Here is my add function as is today, any pointers? public function admin_add() { $this-set('title_for_layout', __('Add new role',true)); if ($this-request-is('post')) { $this-Role-set($this-request-data); if ($this-Role-validates()) { if ($this-Role-save($this-request-data)) { $this-Session-setFlash(__('New role created.',true), 'admin/flash/success'); $this-redirect(array('action' = 'index')); } else { $this-Session-setFlash(__('Could not create role, please try again.',true), 'admin/flash/error'); } } else { // Didn't validate } } $this-set('errors', $this-Role-validationErrors); } -Tom kl. 13:35:30 UTC+2 fredag 3. august 2012 skrev SoulRaven følgende: i use a single method, add/edit even if is user or admin, the difference between add/edit is that on edit you have the ID set, or in parameter or in $this-data admin_editpost($id = null){ if(is_null($id){ //something } } i guess you understand vineri, 3 august 2012, 11:41:01 UTC+3, MetZ a scris: Hi all.. I am in the process of migrate one of my apps fra 1.3 to cakephp 2.x and I am wondering, what are the best practices for the new framework? AND YES, I have read the documents/book :) I am just wondering how you do it, so I can compare my work and see if I am heading in the right direction with my app. So if anyone could give me an idea about a couple simple add/edit functions, and how the best practice for this, I would appreciate it :) like: admin_users_add() { } admin_users_edit() { } and other regular functions you might have an example for. Thanks all! Awesome! -Tom -- 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: CakePHP 2.X Issues with rounting
Set debug to 2. Cake sends a generic 404 when there's an error when debug is disabled. On Fri, Aug 3, 2012 at 3:23 PM, Almog Koren al...@almogdesign.net wrote: Hi everyone, I'm upgrading a baked application from 1.3 to 2.2.1 and I'm running into some issue with the routes, in short its not working. I have Router::connect('/login', array('controller' = 'users', 'action' = 'login')); Set up my controller UsersController and model of course, the login.ctp is at View/Users/login.ctp However I'm getting the following error Not Found The requested URL /app/webroot/login was not found on this server. I tried everything and have no idea why its not working anymore. -- 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: Cakephp 2.X with PEAR:DB drivers
Thanks for your help , i think writting a pear db datasource is a good option. On Fri, May 18, 2012 at 4:11 AM, AD7six andydawso...@gmail.com wrote: Ok, I wanted to be sure you weren't trying to use the PEAR lib with a db that is already well supported. I know nothing about the status of any mssql dbo driver - but there are also numerous references pointing at: https://github.com/rchavik/datasources/blob/mssql-2.0/Model/Datasource/Database/Mssql.php Doesn't that work? If you want to use peardb anyway, you have a few options: * Use Pear directly - you'll lose ~all model functionality * Overwrite a few model methods (find, save) to call the Pear db methods * Write a pear db datasource The last option is potentially the best idea as it would mean you can change the datasource at some point in the future if a better option became available AD -- 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 -- Abhijit Kakade LAMP Developer, MCP,CCNA Mob : +91-9923729250 -- 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.X with PEAR:DB drivers
Ok, I wanted to be sure you weren't trying to use the PEAR lib with a db that is already well supported. I know nothing about the status of any mssql dbo driver - but there are also numerous references pointing at: https://github.com/rchavik/datasources/blob/mssql-2.0/Model/Datasource/Database/Mssql.php Doesn't that work? If you want to use peardb anyway, you have a few options: * Use Pear directly - you'll lose ~all model functionality * Overwrite a few model methods (find, save) to call the Pear db methods * Write a pear db datasource The last option is potentially the best idea as it would mean you can change the datasource at some point in the future if a better option became available AD -- 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.X with PEAR:DB drivers
On Wednesday, 16 May 2012 06:37:53 UTC+2, abhikakade wrote: Hi All I there any way to use cakephp 2.X with PEAR:DB drivers ? i have checked old cake version supports pear connection but not the latest one.. is there any native drivers available to connect with PEAR:DB class ? Why would you want to do that? AD -- 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.X with PEAR:DB drivers
I am using PHP 5.2 + Mssql 2008 + Linux Server and Cake 2.1.2, latest version of cake only Sqlsrv drivers that does not work on Linux box. Because lack of php_mssql drivers in cake i have to use PEAR:DB drivers with cakephp, also i want strong support for store procedure calls that cake in built drivers dosent support. Pear drivers has good function to call Store procedures like below $res = $db-getAll(mystoreprocedure, array($param1, $param2, $param3)); Although i can call SP from cake using $this-query() method but in this function i have to take care of SQL injection, SP out parameters etc.. hope you understand the problem. Thanks, Abhijit On May 16, 3:39 pm, AD7six andydawso...@gmail.com wrote: On Wednesday, 16 May 2012 06:37:53 UTC+2, abhikakade wrote: Hi All I there any way to use cakephp 2.X with PEAR:DB drivers ? i have checked old cake version supports pear connection but not the latest one.. is there any native drivers available to connect with PEAR:DB class ? Why would you want to do that? AD -- 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.x plugin configs
You can use configuration files. Check this gist: https://gist.github.com/1978200 On Saturday, March 3, 2012 5:41:42 PM UTC+1, U-Zyn Chua wrote: Hello, I've been a long time user of CakePHP (since pre v1) but have only recently checked out CakePHP 2.x. I'm writing a plugin for CakePHP 2.x, and am looking for a quick and easy way for users to configure the plugin upon loading it. I'm hoping to achieve something like this: CakePlugin::load('CoolPlugin', array( 'config1' = 'value1', 'config2' = true, 'config3' = array( 'subkeyA' = 'valueA', 'subkeyB' = 'valueB' ) )); But I'm not exactly sure how the values can be passed to CoolPlugin. If that's not the recommended way, please enlighten me on the best way for plugin configurations. Thank you! -- 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.x - Call to undefined method View::fetch()
of course, View::fetch() is available since 2.1, but you have 2.0.5 use $content_for_layout instead -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/1/16 Anna P apad...@o2.pl Hello. I'm starting to build an app on CakePHP 2.x - I have been using version 1.2 since now. I downloaded the 2.0.5 Stable version, set it up on my localhost, created DB with simple table 'subpages' and Subpage model, created simple layout with couple of html tags and: body ?php echo $this-fetch('content'); ? /body And what I get is an error: Fatal error: Call to undefined method View::fetch() in (...)default.ctp on line 14 This is a clean version of Cake, I didn't modify anything. Just added one simple model Subpage.php and default.ctp with call to fetch function, as wrote in Cookbook. Anybody knows what could be the problem? Thanks in advance for help! Anna -- 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: CakePHP 2.x - Call to undefined method View::fetch()
Thanks very much. I've checked Cookbook again - of course I didn't notice a key information which is: New in version 2.1. : On 16 Sty, 17:01, Tilen Majerle tilen.maje...@gmail.com wrote: of course, View::fetch() is available since 2.1, but you have 2.0.5 use $content_for_layout instead -- Hello. I'm starting to build an app on CakePHP 2.x - I have been using version 1.2 since now. I downloaded the 2.0.5 Stable version, set it up on my localhost, created DB with simple table 'subpages' and Subpage model, created simple layout with couple of html tags and: body ?php echo $this-fetch('content'); ? /body And what I get is an error: Fatal error: Call to undefined method View::fetch() in (...)default.ctp on line 14 This is a clean version of Cake, I didn't modify anything. Just added one simple model Subpage.php and default.ctp with call to fetch function, as wrote in Cookbook. Anybody knows what could be the problem? Thanks in advance for help! Anna -- 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: CakePHP 2.X
On Dec 21, 11:56 pm, Ucha19871 ucha19871...@yahoo.com wrote: ooh thx.. I know this documentation,but .. do you have a PDF version of this documentation .. or .CHM file.. so i can use it locally, without Internet.. The source is here, it is quite trivial to build for local use: https://github.com/cakephp/docs AD -- 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.X
@ M Kaufman: What about one with a 42u rack in his random location without Internet, operating quite securely, and avoiding theft or notice? Nice example^^ Must be sth pretty important you are programming. you could simply use two computers then instead of making yourself the most isolated human on earth. one for online research, google (its amazing how many programmers forget that there are search engines on this planet) included, and of course the allmighty cookbook. and one - if it is really necessary - offline from all connections and for your application. But I find that pretty unnatural. Most applications nowadays communicate with the internet in at least some way (google maps, geocoding, webservices, ...). hard to test that stuff in an area51 bunker. it should be possible to use those things in a test environment while having a firewall to protect you. Happy coding :) On 22 Dez., 09:28, AD7six andydawso...@gmail.com wrote: On Dec 21, 11:56 pm, Ucha19871 ucha19871...@yahoo.com wrote: ooh thx.. I know this documentation,but .. do you have a PDF version of this documentation .. or .CHM file.. so i can use it locally, without Internet.. The source is here, it is quite trivial to build for local use:https://github.com/cakephp/docs AD -- 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.X
On Dec 22, 5:38 am, M Kaufman (Gmail) mkfmn...@gmail.com wrote: What about one with a 42u rack in his random location without Internet, operating quite securely, and avoiding theft or notice? I'm exactly in that situation ... I don't what to be distracted while I studding... AD7six - Thanks for this link .. Okay guys thank you very much :) -- 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.X
I guess studding would get in the way of programming. At least for me it does anyway. On 22 Dec 2011, at 12:58:17, Ucha19871 wrote: On Dec 22, 5:38 am, M Kaufman (Gmail) mkfmn...@gmail.com wrote: What about one with a 42u rack in his random location without Internet, operating quite securely, and avoiding theft or notice? I'm exactly in that situation ... I don't what to be distracted while I studding... AD7six - Thanks for this link .. Okay guys thank you very much :) -- 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: CakePHP 2.X
I'm a newbie too :) http://book.cakephp.org/2.0/en/ Regards, Tim On Wed, Dec 21, 2011 at 2:49 PM, Ucha19871 ucha19871...@yahoo.com wrote: Hello, I am new in CakePHP and what to know, when will be CakePHP 2.x book available ? Can you give me links for the new (2.0) book pleas ? -- 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 -- | cellphone: +18579280348 | | 123 10th Street | San Francisco | CA 94103 | | web: www.zign.me | skype: timothy.o.reilly | twitter: @timothyjoreilly | -- 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.X
http://book.cakephp.org/2.0/en/ here we are :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/12/21 Ucha19871 ucha19871...@yahoo.com Hello, I am new in CakePHP and what to know, when will be CakePHP 2.x book available ? Can you give me links for the new (2.0) book pleas ? -- 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: CakePHP 2.X
ooh thx.. I know this documentation,but .. do you have a PDF version of this documentation .. or .CHM file.. so i can use it locally, without Internet.. -- 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.X
a (web)programmer that doesnt have internet? :) On 21 Dez., 23:56, Ucha19871 ucha19871...@yahoo.com wrote: ooh thx.. I know this documentation,but .. do you have a PDF version of this documentation .. or .CHM file.. so i can use it locally, without Internet.. -- 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.X
What about one with a 42u rack in his random location without Internet, operating quite securely, and avoiding theft or notice? Sent from my iPhone On Dec 21, 2011, at 4:50 PM, euromark dereurom...@googlemail.com wrote: a (web)programmer that doesnt have internet? :) On 21 Dez., 23:56, Ucha19871 ucha19871...@yahoo.com wrote: ooh thx.. I know this documentation,but .. do you have a PDF version of this documentation .. or .CHM file.. so i can use it locally, without Internet.. -- 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: CakePHP 2.X
If a tree falls in a forest and no one is around to see it, do all of the other trees make fun of it? On Wed, Dec 21, 2011 at 7:38 PM, M Kaufman (Gmail) mkfmn...@gmail.comwrote: What about one with a 42u rack in his random location without Internet, operating quite securely, and avoiding theft or notice? Sent from my iPhone On Dec 21, 2011, at 4:50 PM, euromark dereurom...@googlemail.com wrote: a (web)programmer that doesnt have internet? :) On 21 Dez., 23:56, Ucha19871 ucha19871...@yahoo.com wrote: ooh thx.. I know this documentation,but .. do you have a PDF version of this documentation .. or .CHM file.. so i can use it locally, without Internet.. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php