Re: Credit card Expiry Date format in CakePHP 3
Hi Mark, Thank you for the update. This is helpful to rename the month name, but unfortunately I couldn't find anything to change the order of select box positions. Thanks, Jipson On Wednesday, 17 September 2014 19:21:14 UTC+1, euromark wrote: According to the docs this is all easily possible: http://book.cakephp.org/3.0/en/core-libraries/helpers/form.html#datetime-options Am Mittwoch, 17. September 2014 15:48:31 UTC+2 schrieb Jipson Thomas: Hi , Is there any option with the date input to change the display order. For example now following code is generating two select box first one with the year and second one with the month name. Actually for my project we require to show the month select option first and then the year select box. Also in the month select box we want to show the month number from 01 to 12 instead of month name. Is there any parameter will do it ? Thanks and Regards, Jipson On Tuesday, 12 August 2014 09:23:42 UTC+1, Jipson Thomas wrote: Thank you Mark. It is working. Regards, Jipson On Monday, 11 August 2014 13:14:37 UTC+1, mark_story wrote: You should be able to set day = false in the options to turn off the day input. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: View Helper
Sure they can easily add helpers $controller-helpers[] = 'MyHelper'; If you get the controller via initialize() or startup(). Am Donnerstag, 18. September 2014 00:54:25 UTC+2 schrieb Marcelo Aymone: Ok... there any way to load a helper throug a controller component? I cant modify the original controller... Em quarta-feira, 17 de setembro de 2014 18h24min27s UTC-3, Marcelo Aymone escreveu: On extending a Form helper, is a good practice inject input fields automatic, with echo command? and... To automatic create some field types, like datepicker, and for example, datepicker uses bootstrap css and js. How insert that scripts through a helper? 'echo $this-Script' inside a helper is wrong? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Array to string conversion error when writing to db
Thanks for your response Mike. I had actually thought of using a join table, but wasn't sure how to do it in Cake. Thanks for pointing me in the right direction. I've read that part of the book now and have mostly got my head round it. I'm not too sure how to get the checkbox ticks into the join table though - is it done automagically? I guess I'll have to just try it all out and see... I've got a helluva lot to learn, and learning as you work is often the best way I know. I could do without the deadline I have though! Regards, Mark. On Wednesday, 17 September 2014 11:11:26 UTC+1, Mike Karthauser wrote: Hi Mark I’d try it a more cakey way. Your model would have the following relationship Registration HasAndBelongsToMany AudienceType id, name AudienceType being your data array(1 = '5-7 years', 2 = '7-11 years', ‘3 = '7-11 years'); You’d store the relationship between the two in a join table so you’d have a table with the following fields registration_id, audience_type_id That would allow you to look up registrations via the audience_type_id My feeling is this is a better way for you to link this Read more in the book http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html HTH. Mike On 17 Sep 2014, at 11:01, MarkB markba...@gmail.com javascript: wrote: Hi, I'm new to CakePHP, OOP and my PHP knowledge skills could probably be considered beginner++ level, so please have patience with me. I'm producing an event registration system for a festival website. I have created a multi-step form that uses a session to temporarily record data. It asks users to specify the ideal audience for their event, based upon age. This needs to allow multiple selections, and I want to collate and write their selections into a single mySQL database text field called 'audience'. The code I'm using to create the multiple selections in my form view is as follows (actual form has several more options) $options = array('5-7' = '5-7 years', '7-11' = '7-11 years', '11-14' = '7-11 years'); echo $this-Form-select('audience', $options, array('multiple' = 'checkbox')); This generates the following HTML: input type=hidden name=data[Proposal][audience] value= id=ProposalAudience/ div class=checkboxinput type=checkbox name=data[Proposal][audience][] value=5-7 id=ProposalAudience57 /label for=ProposalAudience575-7 years/label/div div class=checkboxinput type=checkbox name=data[Proposal][audience][] value=7-11 id=ProposalAudience711 /label for=ProposalAudience7117-11 years/label/div div class=checkboxinput type=checkbox name=data[Proposal][audience][] value=11-14 id=ProposalAudience1114 /label for=ProposalAudience111411-14 years/label/div The code I'm using in my controller file to write to the database is as follows: $arrAudience = $this-Session-read('form.data.audience'); $strAudience = implode($arrAudience); $this-Session-write('form.data.audience', $strAudience); $this-Proposal-save($currentSessionData); But I get the following errors: Warning (2): implode() [function.implode]: Argument must be an array [APP/Controller/ProposalsController.php, line 106] Notice (8): Array to string conversion [CORE/Cake/Model/Datasource/DboSource.php, line 1009] The SQL query dump has the word 'Array' where I'd expect my string to be. Where am I going wrong? Should I be using something other than the basic PHP implode function? Thanks for any help you can give. -- 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+u...@googlegroups.com javascript:. To post to this group, send email to cake...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout. Mike Karthäuser Director, Brightstorm Ltd. 1, Brewery Court North Street Bristol BS3 1JS mi...@brightstorm.co.uk javascript: www.brightstorm.co.uk +44(0) 7939252144 -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Best practice to get menu array
Can I bump my topic again? :) I realy hope I'll find an answer on this one, it's all about keeping the MVC as clear as possible ;) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Has the naming of controllers in cakePHP 2.5.4 been changed?
I named a post controller for a certain project as posts_controller.php while using cakePHP 2.5.4.I got an error that PostsController.php could not be found.After i renamed to PostsController.php,the error was corrected but i encountered an internal error which i've not been able to solve.Has the naming of the controllers been changed?I'm a newbie to cakePHP so i'll be very glad to get your help bakers. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: Array to string conversion error when writing to db
Thanks for your response Mike. I had actually thought of using a join table, but wasn't sure how to do it in Cake. Thanks for pointing me in the right direction. I've now set up my join table and got it all successfully working. CakePHP makes things so simple, once you've got your head around it! It's all great, apart from one thing... I want validation to check that at least one checkbox is selected when the form is submitted, but I can't seem to get it to work. I've tried the following code in both my Proposal model and my new Audience model. public $validate = array('audience' = array('rule' = array('multiple', array('min' = 1; Here's the code for the relevant content... // Controllers/ProposalsController.php $this-set('audiences', $this-Proposal-Audience-find('list', array('fields'=array('Audience.id', 'Audience.agegroup'; // Proposals/add.ctp echo $this-Form-input('Audience', array('multiple' = 'checkbox')); // HTML generated from above (edited fore brevity) div class=input selectlabel for=AudienceAudienceAudience/labelinput type=hidden name=data[Audience][Audience] value= id=AudienceAudience/ div class=checkboxinput type=checkbox name=data[Audience][Audience][] value=1 id=AudienceAudience1 /label for=AudienceAudience1Suitable for all ages/label/div div class=checkboxinput type=checkbox name=data[Audience][Audience][] value=2 id=AudienceAudience2 /label for=AudienceAudience2Lower primary (5-7 years)/label/div div class=checkboxinput type=checkbox name=data[Audience][Audience][] value=3 id=AudienceAudience3 /label for=AudienceAudience3Upper primary (7-11 years)/label/div/div If you can help me get the validation working I'll be most grateful! Thanks, Mark. On Wednesday, 17 September 2014 11:11:26 UTC+1, Mike Karthauser wrote: Hi Mark I’d try it a more cakey way. Your model would have the following relationship Registration HasAndBelongsToMany AudienceType id, name AudienceType being your data array(1 = '5-7 years', 2 = '7-11 years', ‘3 = '7-11 years'); You’d store the relationship between the two in a join table so you’d have a table with the following fields registration_id, audience_type_id That would allow you to look up registrations via the audience_type_id My feeling is this is a better way for you to link this Read more in the book http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html HTH. Mike On 17 Sep 2014, at 11:01, MarkB markba...@gmail.com javascript: wrote: Hi, I'm new to CakePHP, OOP and my PHP knowledge skills could probably be considered beginner++ level, so please have patience with me. I'm producing an event registration system for a festival website. I have created a multi-step form that uses a session to temporarily record data. It asks users to specify the ideal audience for their event, based upon age. This needs to allow multiple selections, and I want to collate and write their selections into a single mySQL database text field called 'audience'. The code I'm using to create the multiple selections in my form view is as follows (actual form has several more options) $options = array('5-7' = '5-7 years', '7-11' = '7-11 years', '11-14' = '7-11 years'); echo $this-Form-select('audience', $options, array('multiple' = 'checkbox')); This generates the following HTML: input type=hidden name=data[Proposal][audience] value= id=ProposalAudience/ div class=checkboxinput type=checkbox name=data[Proposal][audience][] value=5-7 id=ProposalAudience57 /label for=ProposalAudience575-7 years/label/div div class=checkboxinput type=checkbox name=data[Proposal][audience][] value=7-11 id=ProposalAudience711 /label for=ProposalAudience7117-11 years/label/div div class=checkboxinput type=checkbox name=data[Proposal][audience][] value=11-14 id=ProposalAudience1114 /label for=ProposalAudience111411-14 years/label/div The code I'm using in my controller file to write to the database is as follows: $arrAudience = $this-Session-read('form.data.audience'); $strAudience = implode($arrAudience); $this-Session-write('form.data.audience', $strAudience); $this-Proposal-save($currentSessionData); But I get the following errors: Warning (2): implode() [function.implode]: Argument must be an array [APP/Controller/ProposalsController.php, line 106] Notice (8): Array to string conversion [CORE/Cake/Model/Datasource/DboSource.php, line 1009] The SQL query dump has the word 'Array' where I'd expect my string to be. Where am I going wrong? Should I be using something other than the basic PHP implode function? Thanks for any help you can give. -- 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
belongsTo proper usage to avoid 1052 ambiguity?
I am in the midst of migrating a large codebase from cake1.2 to the latest cake1.3 - all has been proceeding nicely until I hit an issue with one of the models and how find('all) is generating the SQL request. The find('all') request is in the comments class controller and requests 3 comment records in their entirety. Each comment SQL record has an angler_id and an author_id foreign and the below stub is from the comments model. class Comment extends AppModel { var $name = 'Comment'; var $belongsTo = array( Angler' = array( 'className' = 'Angler' ), Author' = array( 'className' = 'Angler' ), ); } The angler records have a field called 'favorite lure' among numerous other fields. Author and Angler both refer to angler records. This worked perfectly fine in the 1.2 code, but for some reason 1.3 is generating the following SQL request in which the 'favorite lure' field (only that one) is ambiguous and I get a 1052 error code. Note none of the other angler fields are complained about as ambiguous. Query: SELECT `Comment`.`id`, `Comment`.`catch_id`, `Comment`.`angler_id`, `Comment`.`text`, `Comment`.`datetime`, `Comment`.`author_id`, `Comment`. `private`, `Angler`.`id`, `Angler`.`username`, `Angler`.`password`, `Angler` .`email`, `Angler`.`active`, `Angler`.`autologin_key`, `Angler`.`role`, `Angler`.`first_name`, `Angler`.`last_name`, `Angler`.`address`, `Angler`. `city`, `Angler`.`state`, `Angler`.`zip`, `Angler`.`phone`, `Angler`.`boat`, `favorite lure`, `Angler`.`created`, `Angler`.`ip`, `Angler`.`aoty_rank`, `Angler`. `aoty_points`, `Angler`.`aoty_events`, `Author`.`id`, `Author`.`username`, `Author`.`password`, `Author`.`email`, `Author`.`active`, `Author`. `autologin_key`, `Author`.`role`, `Author`.`first_name`, `Author`. `last_name`, `Author`.`address`, `Author`.`city`, `Author`.`state`, `Author` .`zip`, `Author`.`phone`, `Author`.`boat`, `Author`.`created`, `Author`.`ip` , `Author`.`aoty_rank`, `Author`.`aoty_points`, `Author`.`aoty_events` FROM `comments` AS `Comment` LEFT JOIN `anglers` AS `Angler` ON (`Comment`. `angler_id` = `Angler`.`id`) LEFT JOIN `anglers` AS `Author` ON (`Comment`. `author_id` = `Author`.`id`) WHERE `Comment`.`private` = 0 ORDER BY `Comment`.`datetime` DESC LIMIT 3 Both Author and Angler have all the same fields but for some reason things go awry with the 'favorite lure' field. Any advice on solving this is greatly 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/d/optout.
Re: Has the naming of controllers in cakePHP 2.5.4 been changed?
It always was PostsController.php in 2.x - as documented Am Donnerstag, 18. September 2014 18:45:58 UTC+2 schrieb vincent mbogo: I named a post controller for a certain project as posts_controller.php while using cakePHP 2.5.4.I got an error that PostsController.php could not be found.After i renamed to PostsController.php,the error was corrected but i encountered an internal error which i've not been able to solve.Has the naming of the controllers been changed?I'm a newbie to cakePHP so i'll be very glad to get your help bakers. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.