Re: How can controller action function distinguish whether URL ends with .xml or not?
From what i remember this should do the trick, in your controller action if ( $this-RequestHandler-isXML()) { // do some xml specific code } Check out the documentation on Request Handling for more details. http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html On Friday, September 14, 2012 6:31:38 AM UTC+3, Lightee wrote: Dear Cakephp gurus, I am creating some web services using cakephp with XML. When user visit a URL, cakephp is smart enough to detect the URL extension and direct to the correct view folder. For example, if URL ends with .xml, view is directed to the xml folder. My problem comes with the controller. If there any way for controller to know whether URL ends with .xml? Currently, I have to create new actions for add, edit, delete and view just to handle .xml URLs. THank you. -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: PHP Warning: SplFileInfo::openFile(/srv/www/lighttpd/app/tmp/cache/persistent/cake_core_file_map)
Hi I joined and I am posting right now because of the lack of succes I have seen all over the web about this issue and while looking for the solution I found MANY production sites with this warning messages all overas this is the first post that comes up on google when you search for this issue here goes the solution. I solved this problem on fedora 17. I did two things: 1 Add my user to apache group, add apache user to my user group. 2 Read carefully SELinux logs, on fedora I had to issue some commands (that was sugested copy/paste by the details in the SELinux warning) to let cake write files. If your distribution of SE does not give you a simple option to allow or not, disable SELinux as last resort. So add apache and your user to each other group and disable (or allow cake on) SELinux. I hope this helps and bring me good karma =] On Sunday, May 6, 2012 2:09:36 PM UTC-3, Joseph wrote: If you're encountering the SplFileInfo error in CakePHP2 and you're absolutely certain that your file/directory permissions are set up properly, then one other thing to check is your PHP version. Cake2 requires PHP 5.2.8 or greater and although you'd usually be alerted on the default page if you were using the wrong version, you wouldn't be alerted if you'd developed your app on one server and then moved it to another. I experienced this error after developing a Cake2 app on a PHP5.3 server and then moving it to a PHP 5.1 server. Upgrading to 5.2.17 (which is above 5.2.8) solved the problem. On Saturday, February 18, 2012 2:50:13 AM UTC+7, D Mahoney wrote: That suggestion sounds reasonable. Tried that, but still have same issue. I changed the cache config to add 'mask' = 0666 in app/Config/bootstrap.php (Cache::config('default', array('engine' = 'File', 'mask' = 0666));), then deleted the cache files with find ./*/tmp/cache -type f \( -name 'cake_*' -o -name 'element_*' -o -name '*.*' \) -exec rm {} \; then restarted lighttpd. Also made sure to chown /srv/www/lighttpd to lighttpd:lighttpd since that's the user lighttpd will run as. Now when I go to the application URL I'm seeing: *Warning* (2): SplFileInfo::openFile(/srv/www/lighttpd/app/tmp/cache/persistent/cake_core_cake_en-us) [function.SplFileInfo-openFile http://107.22.127.119:8000/function.SplFileInfo-openFile]: failed to open st ream: No such file or directory [*CORE/Cake/Cache/Engine/FileEngine.php*, line *293*] *Warning* (512): Cannot open file '/srv/www/lighttpd/app/tmp/cache/persistent/cake_core_cake_en-us' [*CORE/Cake/Cache/Engine/FileEngine.php*, line*300*] Still at a loss here! On 02/17/2012 01:10 PM, 0x20h wrote: try to set the 'mask' = 0666 option for the file cache (in boostrap.php), then delete all cache files. The Problem occurs when you create the cache files under different users (e.g. from cli and lighttpd as www-data) -- 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-US.
Re: browser compatibility: the weirdest thing ever with IE. throws flash message all the time!!!
If it only occurs on IE it might be a prolem with the user session. Try setting Session.checkAgent to false in core.php and see if that helps. I had problems with sessions getting dropped in IE, with this setting on. On May 31, 9:33 pm, luftlinie thomasfuch...@googlemail.com wrote: hi everyone, I try to explain it shortly. When a user clicks on any profile, my controller function checks if that user is active oder locked. active means account is activated, locked means locked ;). now i have been testing this with chrome, safari and firefox for months!!! the process works, 100%. BUT with Internet Explorer... if I go on any users profile, activated or unlocked, cake throws me the message, although, logically, it is correct in my code. it worked in other browsers and IE goes to those profile without redirecting.. I am not even close to getting this. I am totally stunned. Its so weird. Is there any way, that IE cant handle cakes flash messages, or the CSS with it? here is my controller profile code: === $locked = $this-User-find('first', array( 'fields' = array('User.id','User.locked', 'User.active'), 'conditions' = array('User.id = \''.$id.'\' AND User.locked = false') )); if(!empty($locked)) { if($locked['User']['active'] == true) { if($id != $this-Session-read('User.id')) //visitor!! { some code here } else //profile owner!! { some code here } }//active else { $this-Session-setFlash('this account is not active.'); $this-redirect(array('controller' = 'users', 'action' = 'profile', $this-Session-read('User.id'))); exit(); } }//unlocked else { $this-Session-setFlash('user has been deleted'); $this-redirect(array('controller' = 'users', 'action' = 'profile', $this-Session-read('User.id'))); exit(); } } = so IE always(!) goes to that certain profile throws this line $this-Session-setFlash('this account is not active.'); BTW i am using this code to throw the cake typical messages if($session-check('Message.flash')): echo $session-flash(); endif; appreciate your help. thanks s 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: Class 'AppHelper' not found
If you're encountering this error in Cake 2.1.x, you probably need to copy the AppHelper.php skeleton from: lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php into: app/View/Helper/AppHelper.php I ran into this while upgrading from 1.3.x to 2.1.x. -- 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
loadModel() changes FormHelper output in Cake 2.0.4
I suspect this might be a bug--looking for confirmation, and/or advice on the best place to report it. I have a controller with no associated model. In other words, public $uses = null; I use FormHelper to build a form for a controller action. Because there is no model, the form's ID and input names are not decorated with the model name. I use loadModel() to help process the submitted form values, after checking $this-request-isPost(). When FormHelper creates the form after this, it uses the loaded model name in the form's ID and input names. This means subsequently submitted form values have moved to a different location in $this-request-data. Maybes the workaround is to call loadModel() on every action, whether I need to use it or not...but that is awkward. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Using EmailComponent inside a component or abstract controller
To the best of my knowledge, both of these are impossible in CakePHP 1.3.6: - Use EmailComponent inside another component to send a message - Create a controller class BETWEEN AppController and the child controllers in the inheritance hierarchy, that uses EmailComponent to send a message I would appreciate conformation that I am correct, or a trivial code sample to show how I am wrong. And if either of these are possible in Cake 1.3.7, please let me know. Thanks. -- 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: Want generatetreelist() results in alphabetical order
On Nov 22, 1:09 am, AD7six andydawso...@gmail.com wrote: I'd recommend looking at the reorder method, which'll do what you want to the data itself, unless you're wanting to sort by a different field. http://api.cakephp.org/view_source/tree-behavior/#l-628 Thanks, reorder() was in fact the first thing I tried. It did not reorder all the nodes as I desired, and as my solution in this thread does. Can't remember why. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Want generatetreelist() results in alphabetical order
http://book.cakephp.org/view/1348/generatetreelist generatetreelist() returns a pseudo-tree in a relative order, with children under parents. I would like results wherein the peers are also ordered, alphabetically by label. Here is a quick example if this isn't clear: array( [1] = My Categories, [2] = _Fun, [3] = __Sport, [4] = ___Surfing, [16] = ___Skating, ) This array is not fully ordered (to my liking anyway). Surfing is above Skating, when it should be below. When an array contains dozens of elements like this, it is difficult to find what you are looking for (without alphabetical ordering). The only past online discussions I can find on this issue, end with If you want this solved, then write the function yourself. So my question is... has anyone wrote the solution yet? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Want generatetreelist() results in alphabetical order
OK, I decided to bake up a solution myself. I don't contend that it is the fastest or the best, but it is simple and it seems to work. Drop these two functions into your model and call the first. // // Convert the results of a $this-find('threaded') call into a list, wherein all items // are ordered as a tree. Unlike generatetreelist() (as of Cake 1.3), peers in this // list are also ordered (however they were by the preceding find() ). // This is meant to be used in models with Tree behavior. // // Inputs: // $find_results - output from $this-find('threaded') // $table - the name of the model containing keys and values // $key - the name of the value in the model to become the key in the output array (e.g. 'id') // $value - the name of value in the model to become the value in the output array (e.g. 'name') // // Output: a flat, one-dimensional array similar to that from generatetreelist() // function _threadedFindToTreeList($find_results, $table, $key, $value, $spacer = '--') { $our_results = array(); $this-_threadedFindToTreeListR($find_results, $table, $key, $value, $spacer, 0, $our_results); return $our_results; } // // function _threadedFindToTreeListR($find_results, $table, $key, $value, $spacer, $recursion_lvl, $our_results) { foreach($find_results as $item) { if ( isset($item[$table]) ) { // Add one entry to the bottom of our accumulated results. $spaced_val = ''; for ($i = 0; $i $recursion_lvl; $i++) $spaced_val .= $spacer; $spaced_val .= $item[$table][$value]; $our_results[ $item[$table][$key] ] = $spaced_val; if ( isset($item['children']) ) $this-_threadedFindToTreeListR($item['children'], $table, $key, $value, $spacer, $recursion_lvl+1, $our_results); } } } On Nov 21, 6:12 pm, Johnny Cupcake sparklew...@hotmail.com wrote: http://book.cakephp.org/view/1348/generatetreelist generatetreelist() returns a pseudo-tree in a relative order, with children under parents. I would like results wherein the peers are also ordered, alphabetically by label. Here is a quick example if this isn't clear: array( [1] = My Categories, [2] = _Fun, [3] = __Sport, [4] = ___Surfing, [16] = ___Skating, ) This array is not fully ordered (to my liking anyway). Surfing is above Skating, when it should be below. When an array contains dozens of elements like this, it is difficult to find what you are looking for (without alphabetical ordering). The only past online discussions I can find on this issue, end with If you want this solved, then write the function yourself. So my question is... has anyone wrote the solution yet? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Adding multiple form fields with autocomplete
Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application: http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding multiple form fields with autocomplete
So I've looked further into this, and I tried the obvious solution It seems that the items in $this-data are assigned a number from the name field of the input element. name=data[PracticeInstance][0][tempostart] means the form will feed the data back as $this- data['PracticeInstance']['0']['tempostart'] So when I created my ajax autoComplete field I tried: $ajax-autoComplete('PracticeItem.name', '/practice_items/ autoCompleteName', array('name' = 'data[PracticeItem][0][name]')); For some reason the second autocomplete field won't autocomplete. When I submit the form though, my $this-data looks like: Array ( [PracticeItem] = Array ( [name] = TEST ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 120 [tempofinish] = 130 ) [1] = Array ( [timeminutes] = 40 [tempostart] = 100 [tempofinish] = 110 ) ) ) As you can see, the PracticeItem element has the first autoComplete field's data missing, and it acts as though the only bit that qualifies as [PracticeItem][name] is the last entry in the form. On 16 Apr, 15:20, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application:http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding multiple form fields with autocomplete
So I've looked further into this, and I tried the obvious solution It seems that the items in $this-data are assigned a number from the name field of the input element. name=data[PracticeInstance][0][tempostart] means the form will feed the data back as $this- data['PracticeInstance']['0']['tempostart'] So when I created my ajax autoComplete field I tried: $ajax-autoComplete('PracticeItem.name', '/practice_items/ autoCompleteName', array('name' = 'data[PracticeItem][0][name]')); For some reason the second autocomplete field won't autocomplete. When I submit the form though, my $this-data looks like: Array ( [PracticeItem] = Array ( [name] = TEST ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 120 [tempofinish] = 130 ) [1] = Array ( [timeminutes] = 40 [tempostart] = 100 [tempofinish] = 110 ) ) ) As you can see, the PracticeItem element has the first autoComplete field's data missing, and it acts as though the only bit that qualifies as [PracticeItem][name] is the last entry in the form. On 16 Apr, 15:20, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application:http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding multiple form fields with autocomplete
So I've looked further into this, and I tried the obvious solution It seems that the items in $this-data are assigned a number from the name field of the input element. name=data[PracticeInstance][0][tempostart] means the form will feed the data back as $this- data['PracticeInstance']['0']['tempostart'] So when I created my ajax autoComplete field I tried: $ajax-autoComplete('PracticeItem.name', '/practice_items/ autoCompleteName', array('name' = 'data[PracticeItem][0][name]')); For some reason the second autocomplete field won't autocomplete. When I submit the form though, my $this-data looks like: Array ( [PracticeItem] = Array ( [name] = TEST ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 120 [tempofinish] = 130 ) [1] = Array ( [timeminutes] = 40 [tempostart] = 100 [tempofinish] = 110 ) ) ) As you can see, the PracticeItem element has the first autoComplete field's data missing, and it acts as though the only bit that qualifies as [PracticeItem][name] is the last entry in the form. On 16 Apr, 15:20, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application:http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Adding multiple form fields with autocomplete
practice_sessions_controller.php: http://pastebin.com/XHw37WS0 practice_sessions/add.ctp: http://pastebin.com/Z5fGgfxV practice_items_controller.php: (autoCompleteName) http://pastebin.com/SLN72D4T On 16 Apr, 19:38, Johnny Ferguson hyperfle...@gmail.com wrote: So I've looked further into this, and I tried the obvious solution It seems that the items in $this-data are assigned a number from the name field of the input element. name=data[PracticeInstance][0][tempostart] means the form will feed the data back as $this- data['PracticeInstance']['0']['tempostart'] So when I created my ajax autoComplete field I tried: $ajax-autoComplete('PracticeItem.name', '/practice_items/ autoCompleteName', array('name' = 'data[PracticeItem][0][name]')); For some reason the second autocomplete field won't autocomplete. When I submit the form though, my $this-data looks like: Array ( [PracticeItem] = Array ( [name] = TEST ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 120 [tempofinish] = 130 ) [1] = Array ( [timeminutes] = 40 [tempostart] = 100 [tempofinish] = 110 ) ) ) As you can see, the PracticeItem element has the first autoComplete field's data missing, and it acts as though the only bit that qualifies as [PracticeItem][name] is the last entry in the form. On 16 Apr, 15:20, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application:http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php
Re: Adding multiple form fields with autocomplete
digging through the DOM further, I notice that the autocomplete form element creates a div after itself with id=PracticeItemName_autoComplete. It has the same id for each autocomplete form (which would explain why only one works), so I guess my question comes down to: How can I specify the name of this helper div when invoking the $ajax-autoComplete method? On 16 Apr, 19:41, Johnny Ferguson hyperfle...@gmail.com wrote: practice_sessions_controller.php:http://pastebin.com/XHw37WS0 practice_sessions/add.ctp:http://pastebin.com/Z5fGgfxV practice_items_controller.php: (autoCompleteName)http://pastebin.com/SLN72D4T On 16 Apr, 19:38, Johnny Ferguson hyperfle...@gmail.com wrote: So I've looked further into this, and I tried the obvious solution It seems that the items in $this-data are assigned a number from the name field of the input element. name=data[PracticeInstance][0][tempostart] means the form will feed the data back as $this- data['PracticeInstance']['0']['tempostart'] So when I created my ajax autoComplete field I tried: $ajax-autoComplete('PracticeItem.name', '/practice_items/ autoCompleteName', array('name' = 'data[PracticeItem][0][name]')); For some reason the second autocomplete field won't autocomplete. When I submit the form though, my $this-data looks like: Array ( [PracticeItem] = Array ( [name] = TEST ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 120 [tempofinish] = 130 ) [1] = Array ( [timeminutes] = 40 [tempostart] = 100 [tempofinish] = 110 ) ) ) As you can see, the PracticeItem element has the first autoComplete field's data missing, and it acts as though the only bit that qualifies as [PracticeItem][name] is the last entry in the form. On 16 Apr, 15:20, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application:http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group
Re: Adding multiple form fields with autocomplete
I can edit the name of the helper div with the 'div_id' option, but it doesn't seem to let both fields use the autocomplete function. At this point, I'm not sure how to diagnose the issue any further. On 16 Apr, 19:48, Johnny Ferguson hyperfle...@gmail.com wrote: digging through the DOM further, I notice that the autocomplete form element creates a div after itself with id=PracticeItemName_autoComplete. It has the same id for each autocomplete form (which would explain why only one works), so I guess my question comes down to: How can I specify the name of this helper div when invoking the $ajax-autoComplete method? On 16 Apr, 19:41, Johnny Ferguson hyperfle...@gmail.com wrote: practice_sessions_controller.php:http://pastebin.com/XHw37WS0 practice_sessions/add.ctp:http://pastebin.com/Z5fGgfxV practice_items_controller.php: (autoCompleteName)http://pastebin.com/SLN72D4T On 16 Apr, 19:38, Johnny Ferguson hyperfle...@gmail.com wrote: So I've looked further into this, and I tried the obvious solution It seems that the items in $this-data are assigned a number from the name field of the input element. name=data[PracticeInstance][0][tempostart] means the form will feed the data back as $this- data['PracticeInstance']['0']['tempostart'] So when I created my ajax autoComplete field I tried: $ajax-autoComplete('PracticeItem.name', '/practice_items/ autoCompleteName', array('name' = 'data[PracticeItem][0][name]')); For some reason the second autocomplete field won't autocomplete. When I submit the form though, my $this-data looks like: Array ( [PracticeItem] = Array ( [name] = TEST ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 120 [tempofinish] = 130 ) [1] = Array ( [timeminutes] = 40 [tempostart] = 100 [tempofinish] = 110 ) ) ) As you can see, the PracticeItem element has the first autoComplete field's data missing, and it acts as though the only bit that qualifies as [PracticeItem][name] is the last entry in the form. On 16 Apr, 15:20, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've noticed that CakePHP has an autoComplete helper, but I'm having trouble figuring out how to make it work for my application:http://book.cakephp.org/view/632/autoComplete I have 3 controllers: PracticeItems PracticeInstances PracticeSessions A PracticeSession will have 1 or more PracticeInstances A PracticeInstance has 1 PracticeItem I'm working on the add method for PracticeSessions. This form should start with 4 fields: PracticeItem.0.name (this one is autocomplete) PracticeInstance.0.timeminutes PracticeInstance.0.tempostart PracticeInstance.0.tempofinish It shouldn't be hard to add a button that will generate another 4 fields with the value 0 incremented accordingly. My problem is that autoComplete() accepts its argument as ModelName.FieldName. I can't use the notation with a number in the middle. This means when I get back $this-data I have something like: Array ( [PracticeItem] = Array ( [name] = Another Test Item ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) But what I want is Array ( [PracticeItem] = Array ( [0] = Array ( [name] = Another Test Item ) ) [PracticeInstance] = Array ( [0] = Array ( [timeminutes] = 20 [tempostart] = 100 [tempofinish] = 120 ) ) ) This would be trivial for a single entry, but as I'll be adding more form fields on the fly, I'm not sure how it will work if I can't say $ajax-autoComplete('PracticeItem.n.name', '/practice_items/ autoComplete') I'm thinking I could add an extra parameter to the autoComplete function, but since it's built in, I'm not sure how to go about this. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpotherswith their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from
Re: Cake won't save data in $this-data (data relationship weirdness)
If I put the data in manually it sticks. I don't have any validation rules. I'll try the code you recommended. I suppose at least if what I'm doing SHOULD work (can you confirm this?), then I can look through my sql logs and see what's happening. On Apr 15, 2:00 am, Jeremy Burns jeremybu...@me.com wrote: Odd. What happens when you put the data straight into the table without Cake? What are the data types of the fields? Do you have any validation rules in your PracticeInstance model? If not (I have experienced this before) it passes Cake validation but fails at the database level, tricking Cake into thinking that all is OK. Are you running this from within the practice_instances controller? If so, try this: if ($this-PracticeInstance-save($this-data['PracticeInstance'])): --do something else: die(debug($this-PracticeInstance-validationErrors)); endif; And see what pops up. Jeremy Burns jeremybu...@me.com On 15 Apr 2010, at 05:56, Johnny Ferguson wrote: Hi, I'm developing an app that has database relationships. The table in question is like so: tbl practice_instances id - int (primary) created - timestamp (default: null) modified - timestamp (default: null) timeminutes - int practice_session_id - int practice_item_id - int tempostart - int tempofinish - int practice_session_id refers to an entry in the PracticeSession model (PracticeSession hasMany PracticeInstance) practice_item_id refers to an entry in the PracticeItem model (PracticeInstance belongsTo PracticeItem) I have a form under /cakeRoot/practice_instances/add which accepts the following fields: ?php echo $form-create(PracticeInstance); echo $form-input(timeminutes); echo $form-input(practice_session_id); echo $form-input(practice_item_id); echo $form-input(tempostart); echo $form-input(tempofinish); echo $form-end(Create Practice Instance); ? When I submit the form, I can see in my controller dump: [data] = Array ( [PracticeInstance] = Array ( [timeminutes] = 20 [practice_session_id] = 42 [practice_item_id] = 3 [tempostart] = 120 [tempofinish] = 128 ) ) So everything is fine there, but when I look in my table, all the fields other than id, created, and modified are set to a value of 0. This is odd because cake is telling me that it saved $this-data, and as you can see, the values above are not zero. I have the feeling that I'm not understanding something about data relationships. Any idea why these fields are getting set to 0? In the final application users won't really create PracticeInstances manually (it will be part of creating a PracticeSession), but I'd like to be able to add fields for testing. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cake won't save data in $this-data (data relationship weirdness)
Now this is interesting: 100415 0:39:30 159 Connect acc...@localhost on 159 Init DB dev_practicelog 159 Query SHOW TABLES FROM `dev_practicelog` 159 Query DESCRIBE `practice_instances` 159 Query DESCRIBE `practice_items` 159 Query INSERT INTO `practice_instances` (`modified`, `created`) VALUES ('2010-04-15 00:39:30', '2010-04-15 00:39:30') 159 Query SELECT LAST_INSERT_ID() AS insertID 159 Quit It seems Cake isn't inserting the other values, even though they're showing up in my controller dump odd. On Apr 15, 2:22 am, Johnny Ferguson hyperfle...@gmail.com wrote: If I put the data in manually it sticks. I don't have any validation rules. I'll try the code you recommended. I suppose at least if what I'm doing SHOULD work (can you confirm this?), then I can look through my sql logs and see what's happening. On Apr 15, 2:00 am, Jeremy Burns jeremybu...@me.com wrote: Odd. What happens when you put the data straight into the table without Cake? What are the data types of the fields? Do you have any validation rules in your PracticeInstance model? If not (I have experienced this before) it passes Cake validation but fails at the database level, tricking Cake into thinking that all is OK. Are you running this from within the practice_instances controller? If so, try this: if ($this-PracticeInstance-save($this-data['PracticeInstance'])): --do something else: die(debug($this-PracticeInstance-validationErrors)); endif; And see what pops up. Jeremy Burns jeremybu...@me.com On 15 Apr 2010, at 05:56, Johnny Ferguson wrote: Hi, I'm developing an app that has database relationships. The table in question is like so: tbl practice_instances id - int (primary) created - timestamp (default: null) modified - timestamp (default: null) timeminutes - int practice_session_id - int practice_item_id - int tempostart - int tempofinish - int practice_session_id refers to an entry in the PracticeSession model (PracticeSession hasMany PracticeInstance) practice_item_id refers to an entry in the PracticeItem model (PracticeInstance belongsTo PracticeItem) I have a form under /cakeRoot/practice_instances/add which accepts the following fields: ?php echo $form-create(PracticeInstance); echo $form-input(timeminutes); echo $form-input(practice_session_id); echo $form-input(practice_item_id); echo $form-input(tempostart); echo $form-input(tempofinish); echo $form-end(Create Practice Instance); ? When I submit the form, I can see in my controller dump: [data] = Array ( [PracticeInstance] = Array ( [timeminutes] = 20 [practice_session_id] = 42 [practice_item_id] = 3 [tempostart] = 120 [tempofinish] = 128 ) ) So everything is fine there, but when I look in my table, all the fields other than id, created, and modified are set to a value of 0. This is odd because cake is telling me that it saved $this-data, and as you can see, the values above are not zero. I have the feeling that I'm not understanding something about data relationships. Any idea why these fields are getting set to 0? In the final application users won't really create PracticeInstances manually (it will be part of creating a PracticeSession), but I'd like to be able to add fields for testing. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cake won't save data in $this-data (data relationship weirdness)
a beforeSave() in the model yields: app/models/practice_instance.php (line 6) Array ( [PracticeInstance] = Array ( [modified] = 2010-04-15 15:26:21 [created] = 2010-04-15 15:26:21 ) ) --- So somehow cake is rejecting members of $this-data /app/controllers/practice_instances_controller: http://pastebin.com/15wbnaqQ My save is in the add method Here's the view/form (/app/views/practice_instances/add.ctp): http://pastebin.com/pGUb98ew On Apr 15, 3:01 am, Jeremy Burns jeremybu...@me.com wrote: Hmmm. If you don't have any validation rules my code isn't entirely applicable, but I'd still do this: if ($this-PracticeInstance-save($this-data['PracticeInstance'])): --do something else: die(debug($this-data)); endif; At least you'll find out if Cake thinks it has saved it correctly. Also, try this in your model: function beforeSave() { die(debug($this-data)); } Might be interesting to see what is being passed out. Can you show and tell more of the code that is calling the save? Jeremy Burns jeremybu...@me.com On 15 Apr 2010, at 07:24, Johnny Ferguson wrote: Now this is interesting: 100415 0:39:30 159 Connect acc...@localhost on 159 Init DB dev_practicelog 159 Query SHOW TABLES FROM `dev_practicelog` 159 Query DESCRIBE `practice_instances` 159 Query DESCRIBE `practice_items` 159 Query INSERT INTO `practice_instances` (`modified`, `created`) VALUES ('2010-04-15 00:39:30', '2010-04-15 00:39:30') 159 Query SELECT LAST_INSERT_ID() AS insertID 159 Quit It seems Cake isn't inserting the other values, even though they're showing up in my controller dump odd. On Apr 15, 2:22 am, Johnny Ferguson hyperfle...@gmail.com wrote: If I put the data in manually it sticks. I don't have any validation rules. I'll try the code you recommended. I suppose at least if what I'm doing SHOULD work (can you confirm this?), then I can look through my sql logs and see what's happening. On Apr 15, 2:00 am, Jeremy Burns jeremybu...@me.com wrote: Odd. What happens when you put the data straight into the table without Cake? What are the data types of the fields? Do you have any validation rules in your PracticeInstance model? If not (I have experienced this before) it passes Cake validation but fails at the database level, tricking Cake into thinking that all is OK. Are you running this from within the practice_instances controller? If so, try this: if ($this-PracticeInstance-save($this-data['PracticeInstance'])): --do something else: die(debug($this-PracticeInstance-validationErrors)); endif; And see what pops up. Jeremy Burns jeremybu...@me.com On 15 Apr 2010, at 05:56, Johnny Ferguson wrote: Hi, I'm developing an app that has database relationships. The table in question is like so: tbl practice_instances id - int (primary) created - timestamp (default: null) modified - timestamp (default: null) timeminutes - int practice_session_id - int practice_item_id - int tempostart - int tempofinish - int practice_session_id refers to an entry in the PracticeSession model (PracticeSession hasMany PracticeInstance) practice_item_id refers to an entry in the PracticeItem model (PracticeInstance belongsTo PracticeItem) I have a form under /cakeRoot/practice_instances/add which accepts the following fields: ?php echo $form-create(PracticeInstance); echo $form-input(timeminutes); echo $form-input(practice_session_id); echo $form-input(practice_item_id); echo $form-input(tempostart); echo $form-input(tempofinish); echo $form-end(Create Practice Instance); ? When I submit the form, I can see in my controller dump: [data] = Array ( [PracticeInstance] = Array ( [timeminutes] = 20 [practice_session_id] = 42 [practice_item_id] = 3 [tempostart] = 120 [tempofinish] = 128 ) ) So everything is fine there, but when I look in my table, all the fields other than id, created, and modified are set to a value of 0. This is odd because cake is telling me that it saved $this-data, and as you can see, the values above are not zero. I have the feeling that I'm not understanding something about data relationships. Any idea why these fields are getting set to 0? In the final application users won't really create PracticeInstances manually (it will be part of creating a PracticeSession), but I'd like to be able to add fields for testing. Check out the new CakePHP Questions sitehttp
Re: Cake won't save data in $this-data (data relationship weirdness)
Okay, I feel like an idiot. I said: $this-PracticeInstance-save(); instead of: $this-PracticeInstance-save($this-data); foolish me. The datetime fields were autopopulating because a record was being inserted, but it had no data and those are the only fields that get filled automatically. Everything works now. Sorry to kill time with a slight oversight. On Apr 15, 3:30 pm, Johnny Ferguson hyperfle...@gmail.com wrote: a beforeSave() in the model yields: app/models/practice_instance.php (line 6) Array ( [PracticeInstance] = Array ( [modified] = 2010-04-15 15:26:21 [created] = 2010-04-15 15:26:21 ) ) --- So somehow cake is rejecting members of $this-data /app/controllers/practice_instances_controller:http://pastebin.com/15wbnaqQ My save is in the add method Here's the view/form (/app/views/practice_instances/add.ctp):http://pastebin.com/pGUb98ew On Apr 15, 3:01 am, Jeremy Burns jeremybu...@me.com wrote: Hmmm. If you don't have any validation rules my code isn't entirely applicable, but I'd still do this: if ($this-PracticeInstance-save($this-data['PracticeInstance'])): --do something else: die(debug($this-data)); endif; At least you'll find out if Cake thinks it has saved it correctly. Also, try this in your model: function beforeSave() { die(debug($this-data)); } Might be interesting to see what is being passed out. Can you show and tell more of the code that is calling the save? Jeremy Burns jeremybu...@me.com On 15 Apr 2010, at 07:24, Johnny Ferguson wrote: Now this is interesting: 100415 0:39:30 159 Connect acc...@localhost on 159 Init DB dev_practicelog 159 Query SHOW TABLES FROM `dev_practicelog` 159 Query DESCRIBE `practice_instances` 159 Query DESCRIBE `practice_items` 159 Query INSERT INTO `practice_instances` (`modified`, `created`) VALUES ('2010-04-15 00:39:30', '2010-04-15 00:39:30') 159 Query SELECT LAST_INSERT_ID() AS insertID 159 Quit It seems Cake isn't inserting the other values, even though they're showing up in my controller dump odd. On Apr 15, 2:22 am, Johnny Ferguson hyperfle...@gmail.com wrote: If I put the data in manually it sticks. I don't have any validation rules. I'll try the code you recommended. I suppose at least if what I'm doing SHOULD work (can you confirm this?), then I can look through my sql logs and see what's happening. On Apr 15, 2:00 am, Jeremy Burns jeremybu...@me.com wrote: Odd. What happens when you put the data straight into the table without Cake? What are the data types of the fields? Do you have any validation rules in your PracticeInstance model? If not (I have experienced this before) it passes Cake validation but fails at the database level, tricking Cake into thinking that all is OK. Are you running this from within the practice_instances controller? If so, try this: if ($this-PracticeInstance-save($this-data['PracticeInstance'])): --do something else: die(debug($this-PracticeInstance-validationErrors)); endif; And see what pops up. Jeremy Burns jeremybu...@me.com On 15 Apr 2010, at 05:56, Johnny Ferguson wrote: Hi, I'm developing an app that has database relationships. The table in question is like so: tbl practice_instances id - int (primary) created - timestamp (default: null) modified - timestamp (default: null) timeminutes - int practice_session_id - int practice_item_id - int tempostart - int tempofinish - int practice_session_id refers to an entry in the PracticeSession model (PracticeSession hasMany PracticeInstance) practice_item_id refers to an entry in the PracticeItem model (PracticeInstance belongsTo PracticeItem) I have a form under /cakeRoot/practice_instances/add which accepts the following fields: ?php echo $form-create(PracticeInstance); echo $form-input(timeminutes); echo $form-input(practice_session_id); echo $form-input(practice_item_id); echo $form-input(tempostart); echo $form-input(tempofinish); echo $form-end(Create Practice Instance); ? When I submit the form, I can see in my controller dump: [data] = Array ( [PracticeInstance] = Array ( [timeminutes] = 20 [practice_session_id] = 42 [practice_item_id] = 3 [tempostart] = 120 [tempofinish] = 128 ) ) So everything is fine there, but when I look in my table, all the fields other than id
Cake won't save my data
I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php: http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp: http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump: http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Cake won't save my data
I've checked with the folks in the IRC, and it looks like Cake shouldn't care if I'm using InnoDB, but my data still won't show up in the tables regardless of Cake giving me every indication that the save was successful. On 14 Apr, 16:43, Johnny Ferguson hyperfle...@gmail.com wrote: I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump:http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Cake won't save my data
Thanks Alan, my table is definitely being populated now. I've fixed up the controller names to follow the convention. On my PracticeItems/index view I have created a link to the add form like so: echo $html-link('add new item', array('controller' = 'PracticeItems', 'action' = 'add')); When I arrive at the page, the url is /cakeRoot/PracticeItems/add When the form submits, the url changes to /cakeRoot/practice_items/add Why won't $html-link put the url in the conventional format? (practice_items) Would it make more sense to say echo $html-link('add new item', array('controller' = 'practice_items', 'action' = 'add')); in order to keep with convention? Furthermore, when I enable the redirect in practice_items_controller.php, I get an error when the redirect executes. The redirect line is as follows: $this-redirect(array('action' = 'index')); which should take me to /cakeRoot/PracticeItems/index, but instead I get the error: Warning (2): Cannot modify header information - headers already sent by (output started at /var/www/go/htdocs/practicelog/cake/basics.php: 306) [CORE/cake/libs/controller/controller.php, line 644] EDIT: I fixed this issue by disabling the line that said $this-set('debug', pr($this-data)); It would seem sending data to the view makes a redirect impossible. I've included this in case anyone has a similar issue in the future. On 14 Apr, 17:17, Alan Asher a...@asteriskpound.com wrote: In your practice_items_controller.php your pr should not have the lowercase and underscored array element. Check your form or wherever you're assigning this array and your pr should look like Array ( [PracticeItem] = Array ( [name] = Test [description] = Test ) ) PracticeItem is the Model Name This is part of the whole convention over configuration. Alan -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Johnny Ferguson Sent: Wednesday, April 14, 2010 2:10 PM To: CakePHP Subject: Re: Cake won't save my data I've checked with the folks in the IRC, and it looks like Cake shouldn't care if I'm using InnoDB, but my data still won't show up in the tables regardless of Cake giving me every indication that the save was successful. On 14 Apr, 16:43, Johnny Ferguson hyperfle...@gmail.com wrote: I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump:http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Cake won't save data in $this-data (data relationship weirdness)
Hi, I'm developing an app that has database relationships. The table in question is like so: tbl practice_instances id - int (primary) created - timestamp (default: null) modified - timestamp (default: null) timeminutes - int practice_session_id - int practice_item_id - int tempostart - int tempofinish - int practice_session_id refers to an entry in the PracticeSession model (PracticeSession hasMany PracticeInstance) practice_item_id refers to an entry in the PracticeItem model (PracticeInstance belongsTo PracticeItem) I have a form under /cakeRoot/practice_instances/add which accepts the following fields: ?php echo $form-create(PracticeInstance); echo $form-input(timeminutes); echo $form-input(practice_session_id); echo $form-input(practice_item_id); echo $form-input(tempostart); echo $form-input(tempofinish); echo $form-end(Create Practice Instance); ? When I submit the form, I can see in my controller dump: [data] = Array ( [PracticeInstance] = Array ( [timeminutes] = 20 [practice_session_id] = 42 [practice_item_id] = 3 [tempostart] = 120 [tempofinish] = 128 ) ) So everything is fine there, but when I look in my table, all the fields other than id, created, and modified are set to a value of 0. This is odd because cake is telling me that it saved $this-data, and as you can see, the values above are not zero. I have the feeling that I'm not understanding something about data relationships. Any idea why these fields are getting set to 0? In the final application users won't really create PracticeInstances manually (it will be part of creating a PracticeSession), but I'd like to be able to add fields for testing. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
having trouble understanding associations
Looking here: http://book.cakephp.org/view/78/Associations-Linking-Models-Together I'm certain my issue is due to a personal lack of understanding. I'm trying to homebrew a simple app to keep track of my guitar practice. I have the following models: PracticeItem: a specific exercise to be practiced any number of times PracticeInstance: an instance of having practiced one specific PracticeItem PracticeSession: a collection of PracticeInstance My immediate instinct is to say PracticeInstance hasOne PracticeItem. According to the Book: X hasOne Y = table Y having an X_id field. In my case PracticeInstance hasOne PracticeItem would mean: PracticeItems has a field practice_instance_id This makes no sense because if I were to create a PracticeItem called Major Scales 2, I would plan to practice it multiple times. If the field for this PracticeItem looks like id = 123 title = Major Scales 2 practice_instance_id = 23 then I would have to duplicate the PracticeItem every time I practiced it. To me it would make more sense if PracticeInstance looked like: id = primaryKey, autoincrement datetime = ... comment = ... timeSpent = ... practice_item_id = 123 Can anyone explain where I might have mixed things up? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: having trouble understanding associations
It's a little difficult to wrap my head around, but I think I see what's going on. belongsTo is a many to one relation, so many PracticeInstance belong to 1 PracticeItem That defies my intuition, because it's more natural for me to think of a PracticeItem as belonging to a PracticeSession. The PracticeSession has a PracticeItem. I'll work through developing this app, and see if my understanding doesn't grow a little. Thanks, Gian. On Mar 26, 3:17 pm, Gianluca gc1...@googlemail.com wrote: Hello Johnny, class PracticeItem extends AppModel { } class PracticeInstance extends AppModel { var $belongsTo = 'PracticeItem'; } class PracticeSession extends AppModel { var $hasMany = 'PracticeInstance'; } tblPracticeInstances * id * practiceitem_id * practicesession_id * tblPracticeSessions * id * Let me know if you need more. Cheers, Gian. On 26 Mar, 18:57, Johnny Ferguson hyperfle...@gmail.com wrote: Looking here:http://book.cakephp.org/view/78/Associations-Linking-Models-Together I'm certain my issue is due to a personal lack of understanding. I'm trying to homebrew a simple app to keep track of my guitar practice. I have the following models: PracticeItem: a specific exercise to be practiced any number of times PracticeInstance: an instance of having practiced one specific PracticeItem PracticeSession: a collection of PracticeInstance My immediate instinct is to say PracticeInstance hasOne PracticeItem. According to the Book: X hasOne Y = table Y having an X_id field. In my case PracticeInstance hasOne PracticeItem would mean: PracticeItems has a field practice_instance_id This makes no sense because if I were to create a PracticeItem called Major Scales 2, I would plan to practice it multiple times. If the field for this PracticeItem looks like id = 123 title = Major Scales 2 practice_instance_id = 23 then I would have to duplicate the PracticeItem every time I practiced it. To me it would make more sense if PracticeInstance looked like: id = primaryKey, autoincrement datetime = ... comment = ... timeSpent = ... practice_item_id = 123 Can anyone explain where I might have mixed things up? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Re: Bake Screencast not Working?
I got this same problem, and after viewing the file directly, I am extremely disappointed that I had to go through the hassle of filling my comp with garbage like QuickTime just to have some guy show me how to update my PATH variable. *facepalm* Why this isn't on a youtube video is beyond me. On Mar 12, 4:33 pm, mailman nmail...@shaw.ca wrote: Hey all. Thehttp://cakephp.org/screencasts/view/6isn't working in any of my browsers. Anyone have a good tute on how to set up bake on Vista (I know...sorry Vista haters). ;) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
redirect to anchor link for form validation
Hi, I've successfully set up a contact form in cakePHP, and when validation rules in my model don't pass, the form is reloaded with all my validation errors displayed properly. That battle was won :) Now for the tricky part. Can anyone think of a way to not only have the form page reload with error messages, but jump to an anchor link at the top of the form if errors are present? I'm sure I could use javascript for this, but as it stands I can't count on users having javascript enabled. Currently when the form reloads with error messages in place, users have to scroll down from the top of the page, and I see this as a slight problem. Obviously CakePHP is smart enough to redirect to an appropriate URL when validation fails, all I need to do is add #myAnchor to the end of that URL somehow. Any ideas? I've thought of adding a line to my beforeFilter that says something like 1. if we're visiting the form page 2. and if some error flag variable is set 3. catch the URL somehow 4. Add the anchor to the end But I'm not sure on the specifics of how I'd go about this, and as this filter would run before the any page in the controller runs, I have concerns about efficiency. Any ideas? Thanks in advance for your input. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe from this group, send email to cake-php+unsubscribegooglegroups.com or reply to this email with the words REMOVE ME as the subject.
Validation issues for Contact form (doesn't use database)
Hi, I've poured over all the documentation I possibly can, and searched the newsgroups, and haven't yet found a solution to my problem. I'm creating a contact form which doesn't use any databases. As the controller action never calls save(), I don't get any of the nice automatic validation. Here are my files: Contact Model: http://bin.cakephp.org/view/568757600 Contacts Controller: http://bin.cakephp.org/view/1939947381 /views/contact/index.ctp (main form):http://bin.cakephp.org/view/ 526960429 /views/contact/add.ctp:http://bin.cakephp.org/view/378503276 The add() method of my ContactsController will take the data from the form at index.ctp, and if it all validates, send off an e-mail. The else clause near the bottom of the add() method attempts to send the user back to the original form if they made any errors, passing the array of errors so that they can be displayed near the form fields. It doesn't look as though $this-redirect() can pass data to a view, so I'm wondering how I can achieve this. It just seems inefficient to reproduce the form on the add.ctp view. If this is the only option, I'll have to go ahead with it, but if anyone can offer a more elegant solution, I'd be interested to hear of it. Thanks for having a look. If I get this figured out, I'll be sure to write an article on my blog so that complete newbies like myself can figure this out. To me a contact form with validation is extremely basic, and I didn't figure it would be so hard to get this going. I have found articles on how to do this, and although the Contact model has a validation array, the errors aren't automagically popping up on the form, so I need to do it manually somehow. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: New to CakePHP
I accidentally hit reply to author, but for anyone else that visits this thread: Be sure to check out the Auth component: http://book.cakephp.org/view/172/Authentication It's dead simple using this to set up authentication. Coupled with the ACL component, you have an unstoppable force on your hands. On Mar 16, 6:20 am, tashi dawtas...@gmail.com wrote: Hi I am new to cakePHP and i am really interested to learn. But i am stuck from where to begin! So can any body please send me a CRUD application build in CakePHP with authentication? If possible the admin module to manage the application. Tashi Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Validation issues for Contact form (doesn't use database)
Ajax is definitely a working solution, but I'm somewhat leary of requiring users to have javascript enabled (call me a purist :P) An element is definitely a good idea. I'm still wondering if it would be possible to pass data as part of a redirect. I've thought of writing a function to create this functionality, but I'm not sure if it would break the MVC paradigm. Definitely a function I would be interested in knowing about, or seeing in future versions of CakePHP. Thanks for the suggestion, John. On Mar 16, 4:21 pm, John Andersen j.andersen...@gmail.com wrote: I would consider the use of an element to hold the contact form. Then have the contact form presented in both views! Seehttp://book.cakephp.org/view/97/Elementsfor the story on elements :) Later you may consider using an AJAX solution. Enjoy, John On Mar 16, 9:48 pm, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've poured over all the documentation I possibly can, and searched the newsgroups, and haven't yet found a solution to my problem. I'm creating a contact form which doesn't use any databases. As the controller action never calls save(), I don't get any of the nice automatic validation. Here are my files: Contact Model:http://bin.cakephp.org/view/568757600 Contacts Controller:http://bin.cakephp.org/view/1939947381 /views/contact/index.ctp (main form):http://bin.cakephp.org/view/ 526960429 /views/contact/add.ctp:http://bin.cakephp.org/view/378503276 The add() method of my ContactsController will take the data from the form at index.ctp, and if it all validates, send off an e-mail. The else clause near the bottom of the add() method attempts to send the user back to the original form if they made any errors, passing the array of errors so that they can be displayed near the form fields. It doesn't look as though $this-redirect() can pass data to a view, so I'm wondering how I can achieve this. It just seems inefficient to reproduce the form on the add.ctp view. If this is the only option, I'll have to go ahead with it, but if anyone can offer a more elegant solution, I'd be interested to hear of it. Thanks for having a look. If I get this figured out, I'll be sure to write an article on my blog so that complete newbies like myself can figure this out. To me a contact form with validation is extremely basic, and I didn't figure it would be so hard to get this going. I have found articles on how to do this, and although the Contact model has a validation array, the errors aren't automagically popping up on the form, so I need to do it manually somehow. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Validation issues for Contact form (doesn't use database)
Having the form submit to the index() function worked brilliantly. To my surprise, this enabled the automagic validation messages! All I have to do now is style the messages with CSS, and I have the trickiest part of my project done. I'll be sure to post a link to the blog post I plan to write on this topic when it's finished. I found plenty of blogs describing what to do generally, but I find they assumed a great deal of familiarity with the framework. Since this is a bit of an odd case, I'd like to create a comprehensive guide. Thanks a bunch, John. On Mar 16, 4:32 pm, John Andersen j.andersen...@gmail.com wrote: You are welcome! :) Another idea, which I do sometime use, is to let the index method process the contact add request. The way I recognise that the contact add form is the one to process, is that I name each submit buttons specifically after what they do - in the contact add form case, it would be named doAddContact. The name of the submit button can be found as a key in the $this- params array. Just an idea, enjoy, John On Mar 16, 10:27 pm, Johnny Ferguson hyperfle...@gmail.com wrote: Ajax is definitely a working solution, but I'm somewhat leary of requiring users to have javascript enabled (call me a purist :P) An element is definitely a good idea. I'm still wondering if it would be possible to pass data as part of a redirect. I've thought of writing a function to create this functionality, but I'm not sure if it would break the MVC paradigm. Definitely a function I would be interested in knowing about, or seeing in future versions of CakePHP. Thanks for the suggestion, John. On Mar 16, 4:21 pm, John Andersen j.andersen...@gmail.com wrote: I would consider the use of an element to hold the contact form. Then have the contact form presented in both views! Seehttp://book.cakephp.org/view/97/Elementsforthestory on elements :) Later you may consider using an AJAX solution. Enjoy, John On Mar 16, 9:48 pm, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've poured over all the documentation I possibly can, and searched the newsgroups, and haven't yet found a solution to my problem. I'm creating a contact form which doesn't use any databases. As the controller action never calls save(), I don't get any of the nice automatic validation. Here are my files: Contact Model:http://bin.cakephp.org/view/568757600 Contacts Controller:http://bin.cakephp.org/view/1939947381 /views/contact/index.ctp (main form):http://bin.cakephp.org/view/ 526960429 /views/contact/add.ctp:http://bin.cakephp.org/view/378503276 The add() method of my ContactsController will take the data from the form at index.ctp, and if it all validates, send off an e-mail. The else clause near the bottom of the add() method attempts to send the user back to the original form if they made any errors, passing the array of errors so that they can be displayed near the form fields. It doesn't look as though $this-redirect() can pass data to a view, so I'm wondering how I can achieve this. It just seems inefficient to reproduce the form on the add.ctp view. If this is the only option, I'll have to go ahead with it, but if anyone can offer a more elegant solution, I'd be interested to hear of it. Thanks for having a look. If I get this figured out, I'll be sure to write an article on my blog so that complete newbies like myself can figure this out. To me a contact form with validation is extremely basic, and I didn't figure it would be so hard to get this going. I have found articles on how to do this, and although the Contact model has a validation array, the errors aren't automagically popping up on the form, so I need to do it manually somehow. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Validation issues for Contact form (doesn't use database)
Now here's a tricky extension (still determined to avoid AJAX). When my form fails, and validation errors pop up, how could I have the page jump to an anchor link connected to the form? The top section of my page is somewhat large, so I'd like to avoid excessive scrolling with an anchor link. + 1,000,000 bonus points to anyone who can figure this out On Mar 16, 5:07 pm, Johnny Ferguson hyperfle...@gmail.com wrote: Having the form submit to the index() function worked brilliantly. To my surprise, this enabled the automagic validation messages! All I have to do now is style the messages with CSS, and I have the trickiest part of my project done. I'll be sure to post a link to the blog post I plan to write on this topic when it's finished. I found plenty of blogs describing what to do generally, but I find they assumed a great deal of familiarity with the framework. Since this is a bit of an odd case, I'd like to create a comprehensive guide. Thanks a bunch, John. On Mar 16, 4:32 pm, John Andersen j.andersen...@gmail.com wrote: You are welcome! :) Another idea, which I do sometime use, is to let the index method process the contact add request. The way I recognise that the contact add form is the one to process, is that I name each submit buttons specifically after what they do - in the contact add form case, it would be named doAddContact. The name of the submit button can be found as a key in the $this- params array. Just an idea, enjoy, John On Mar 16, 10:27 pm, Johnny Ferguson hyperfle...@gmail.com wrote: Ajax is definitely a working solution, but I'm somewhat leary of requiring users to have javascript enabled (call me a purist :P) An element is definitely a good idea. I'm still wondering if it would be possible to pass data as part of a redirect. I've thought of writing a function to create this functionality, but I'm not sure if it would break the MVC paradigm. Definitely a function I would be interested in knowing about, or seeing in future versions of CakePHP. Thanks for the suggestion, John. On Mar 16, 4:21 pm, John Andersen j.andersen...@gmail.com wrote: I would consider the use of an element to hold the contact form. Then have the contact form presented in both views! Seehttp://book.cakephp.org/view/97/Elementsforthestoryon elements :) Later you may consider using an AJAX solution. Enjoy, John On Mar 16, 9:48 pm, Johnny Ferguson hyperfle...@gmail.com wrote: Hi, I've poured over all the documentation I possibly can, and searched the newsgroups, and haven't yet found a solution to my problem. I'm creating a contact form which doesn't use any databases. As the controller action never calls save(), I don't get any of the nice automatic validation. Here are my files: Contact Model:http://bin.cakephp.org/view/568757600 Contacts Controller:http://bin.cakephp.org/view/1939947381 /views/contact/index.ctp (main form):http://bin.cakephp.org/view/ 526960429 /views/contact/add.ctp:http://bin.cakephp.org/view/378503276 The add() method of my ContactsController will take the data from the form at index.ctp, and if it all validates, send off an e-mail. The else clause near the bottom of the add() method attempts to send the user back to the original form if they made any errors, passing the array of errors so that they can be displayed near the form fields. It doesn't look as though $this-redirect() can pass data to a view, so I'm wondering how I can achieve this. It just seems inefficient to reproduce the form on the add.ctp view. If this is the only option, I'll have to go ahead with it, but if anyone can offer a more elegant solution, I'd be interested to hear of it. Thanks for having a look. If I get this figured out, I'll be sure to write an article on my blog so that complete newbies like myself can figure this out. To me a contact form with validation is extremely basic, and I didn't figure it would be so hard to get this going. I have found articles on how to do this, and although the Contact model has a validation array, the errors aren't automagically popping up on the form, so I need to do it manually somehow. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: After the Cake is baked...
Brilliant, this is almost exactly what I was looking for. On Feb 24, 8:28 am, Christian Leskowsky christian.leskow...@gmail.com wrote: Here's something I haven't read yet but was written by a guy who knows his stuff... http://boagworld.com/websiteownersmanual/ http://boagworld.com/websiteownersmanual/ Some good material in there for ya. On Wed, Feb 24, 2010 at 11:26 AM, Christian Leskowsky christian.leskow...@gmail.com wrote: For backups you should be taking full mysql backups of your database nightly - at least while that's feasible - and storing them offsite. (S3 is what I personally use.) Keep at least a week's worth of backups in case you accidentally drop table or something equally terrible happens. Make sure you test restoring from your backup too... regularly. What often happens is you may very well have an ironclad backup strategy but when it comes time to actually restore your data after an outage the backup doesn't work. Other things you should think about backing up: any content uploaded by users including photos, video, text, etc. You should be backing up source code, your project management tool if you're using one and anything else you'd really hate to lose. Good luck! On Tue, Feb 23, 2010 at 11:58 AM, WebbedIT p...@webbedit.co.uk wrote: I think the OP put the main emphasis on legal requirements himself, but fair point he did mention running the site as well as administrative and technical issues. I think the subject matters are little too general to be able to recommend a selection of books that will be ideal for you. I am guilty of not reading enough books myself, which further diminishes my ability to make good recommendations. I would say the first thing you need after launching a site is quality traffic, so the first 6 months is likely to be spent on writing good content that sets your website apart form the rest and then carrying out SEO (possibly SEM depending on your budget) efforts to make sure people know it exists. An important part of this process is statistical analysis of your traffic and you can't go far wrong if using Google Analytics. I bought 'Web Analytics: An Hour A Day' which is highly recommended nut haven't had the time to read it in detail and can;t remember if it is software specific or general?!? Once you have traffic you then need to be concerned about supporting your users and correcting any identified bugs, keeping an eye on user generated content, managing relationships between site members if you have any social networking features and controlling comment spam. Your technical issues all really lie with whoever you host your website with, so choose them carefully. Do a lot of research and make sure whoever you go with will be available and willing to help when you do encounter issues with your hosting. It's also a good idea do go with a host who provides you with a high quality Control Panel, SSH access and phpMyAdmin etc. as this allows you to do a lot of tweaks and fixes yourself. Other stuff to consider is how often does the host upgrade their server software such as updates to the Control Panel, MySQL, PHP, Anti-Virus, Webmail etc. It all sounds a lot when you right it down, but really running a website is not overly time intensive, unless you;re running a highly successful site, and that would be nice, but is unlikely to happen over-night. Launch it and tackle the issues head on as the arise, but most of all enjoy it, it sure beats a 9-5 desk job if it can replace the wage! Paul. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- - You can't reason people out of a position they didn't use reason to get into. Christian Leskowsky -- - You can't reason people out of a position they didn't use reason to get into. Christian Leskowsky Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: After the Cake is baked...
Do go on...is there a Cake-friendly method for automated daily DB backups? How do you accomplish it? On Feb 24, 8:26 am, Christian Leskowsky christian.leskow...@gmail.com wrote: For backups you should be taking full mysql backups of your database nightly - at least while that's feasible - and storing them offsite. (S3 is what I personally use.) Keep at least a week's worth of backups in case you accidentally drop table or something equally terrible happens. Make sure you test restoring from your backup too... regularly. What often happens is you may very well have an ironclad backup strategy but when it comes time to actually restore your data after an outage the backup doesn't work. Other things you should think about backing up: any content uploaded by users including photos, video, text, etc. You should be backing up source code, your project management tool if you're using one and anything else you'd really hate to lose. Good luck! On Tue, Feb 23, 2010 at 11:58 AM, WebbedIT p...@webbedit.co.uk wrote: I think the OP put the main emphasis on legal requirements himself, but fair point he did mention running the site as well as administrative and technical issues. I think the subject matters are little too general to be able to recommend a selection of books that will be ideal for you. I am guilty of not reading enough books myself, which further diminishes my ability to make good recommendations. I would say the first thing you need after launching a site is quality traffic, so the first 6 months is likely to be spent on writing good content that sets your website apart form the rest and then carrying out SEO (possibly SEM depending on your budget) efforts to make sure people know it exists. An important part of this process is statistical analysis of your traffic and you can't go far wrong if using Google Analytics. I bought 'Web Analytics: An Hour A Day' which is highly recommended nut haven't had the time to read it in detail and can;t remember if it is software specific or general?!? Once you have traffic you then need to be concerned about supporting your users and correcting any identified bugs, keeping an eye on user generated content, managing relationships between site members if you have any social networking features and controlling comment spam. Your technical issues all really lie with whoever you host your website with, so choose them carefully. Do a lot of research and make sure whoever you go with will be available and willing to help when you do encounter issues with your hosting. It's also a good idea do go with a host who provides you with a high quality Control Panel, SSH access and phpMyAdmin etc. as this allows you to do a lot of tweaks and fixes yourself. Other stuff to consider is how often does the host upgrade their server software such as updates to the Control Panel, MySQL, PHP, Anti-Virus, Webmail etc. It all sounds a lot when you right it down, but really running a website is not overly time intensive, unless you;re running a highly successful site, and that would be nice, but is unlikely to happen over-night. Launch it and tackle the issues head on as the arise, but most of all enjoy it, it sure beats a 9-5 desk job if it can replace the wage! Paul. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- - You can't reason people out of a position they didn't use reason to get into. Christian Leskowsky Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: After the Cake is baked...
I am most concerned about legal issues because I am least equipped to handle those myself. While I do not necessarily expect to be sued, frankly I do expect to be threatened with lawsuits in short order, and I want to know exactly where I stand before that happens. (I intend to create a crowd-sourced review site, somewhat similar to Yelp.) I could pay a lawyer $400 for an overview, but I'd rather spend $40 on a book with the same information. Or even better, get input from people in this group who have already walked the path. On Feb 23, 8:58 am, WebbedIT p...@webbedit.co.uk wrote: I think the OP put the main emphasis on legal requirements himself, but fair point he did mention running the site as well as administrative and technical issues. I think the subject matters are little too general to be able to recommend a selection of books that will be ideal for you. I am guilty of not reading enough books myself, which further diminishes my ability to make good recommendations. I would say the first thing you need after launching a site is quality traffic, so the first 6 months is likely to be spent on writing good content that sets your website apart form the rest and then carrying out SEO (possibly SEM depending on your budget) efforts to make sure people know it exists. An important part of this process is statistical analysis of your traffic and you can't go far wrong if using Google Analytics. I bought 'Web Analytics: An Hour A Day' which is highly recommended nut haven't had the time to read it in detail and can;t remember if it is software specific or general?!? Once you have traffic you then need to be concerned about supporting your users and correcting any identified bugs, keeping an eye on user generated content, managing relationships between site members if you have any social networking features and controlling comment spam. Your technical issues all really lie with whoever you host your website with, so choose them carefully. Do a lot of research and make sure whoever you go with will be available and willing to help when you do encounter issues with your hosting. It's also a good idea do go with a host who provides you with a high quality Control Panel, SSH access and phpMyAdmin etc. as this allows you to do a lot of tweaks and fixes yourself. Other stuff to consider is how often does the host upgrade their server software such as updates to the Control Panel, MySQL, PHP, Anti-Virus, Webmail etc. It all sounds a lot when you right it down, but really running a website is not overly time intensive, unless you;re running a highly successful site, and that would be nice, but is unlikely to happen over-night. Launch it and tackle the issues head on as the arise, but most of all enjoy it, it sure beats a 9-5 desk job if it can replace the wage! Paul. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: After the Cake is baked...
Seriously though, surely someone can answer this question? If you can't point to a particular book, then what, in your experience, are the 3-5 most important points when first launching your Cake site? (Aside from stop being an American that is.) On Feb 22, 7:24 am, Martin Westin martin.westin...@gmail.com wrote: Avoid getting sued? Stop being an american work like a charm. ;) (sorry, I could not resist) On Feb 22, 8:39 am, Johnny Cupcake sparklew...@hotmail.com wrote: OK, so after we have successfully built our modern, interactive CakePHP website...where can we learn how to actually /run/ the website? Can you recommend any books or forums that provide a good introduction to all the legal, administrative and technical issues? For instance, best practices for data backups, how to avoid getting sued into oblivion, et cetera. The post title is in fun, of course--we all know these issues should be dealt with _before_ any coding takes place...right? ;) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
After the Cake is baked...
OK, so after we have successfully built our modern, interactive CakePHP website...where can we learn how to actually /run/ the website? Can you recommend any books or forums that provide a good introduction to all the legal, administrative and technical issues? For instance, best practices for data backups, how to avoid getting sued into oblivion, et cetera. The post title is in fun, of course--we all know these issues should be dealt with _before_ any coding takes place...right? ;) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Identifying the moment of successful login using AuthComponent
How can I run code on AuthComponent's successful login _event_? For example, to record the login date/time in the database? I've tried writing my own login() action in the controller--but by the time that function executes, login has already been performed by the component--so I don't know whether the login _just occurred_, or it happened five minutes ago! Ideas are greatly appreciated. Please note, I am NOT asking how to determine whether the user logged in _at some point_ in the recent past. I want to map the event itself. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Identifying the moment of successful login using AuthComponent
Thanks. I am just a Cake novice--should I infer that there is no solution to my problem that uses AuthComponent as-is? I'm guessing I could modify a few lines in AuthComponent to add a callback, and get the behavior I want--but I'd rather not go down that road if there are simpler options. On Feb 2, 1:30 pm, Miles J mileswjohn...@gmail.com wrote: I added the this functionality to one of my plugins: http://github.com/milesj/forum/blob/master/controllers/users_controll... On Feb 2, 1:22 pm, Johnny Cupcake sparklew...@hotmail.com wrote: How can I run code on AuthComponent's successful login _event_? For example, to record the login date/time in the database? I've tried writing my own login() action in the controller--but by the time that function executes, login has already been performed by the component--so I don't know whether the login _just occurred_, or it happened five minutes ago! Ideas are greatly appreciated. Please note, I am NOT asking how to determine whether the user logged in _at some point_ in the recent past. I want to map the event itself. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Identifying the moment of successful login using AuthComponent
Nevermind, the book does cover this situation. http://book.cakephp.org/view/248/AuthComponent-Variables#autoRedirect-395 The key to the puzzle is understanding that when your login() executes, your form contents have _already_ been processed by AuthComponent...so the login event condition is when (FORM_NOT_EMPTY CREDENTIALS_NOT_ALREADY_REJECTED). I swear, I did read the docs before I asked in the first place ;) On Feb 2, 1:22 pm, Johnny Cupcake sparklew...@hotmail.com wrote: How can I run code on AuthComponent's successful login _event_? For example, to record the login date/time in the database? I've tried writing my own login() action in the controller--but by the time that function executes, login has already been performed by the component--so I don't know whether the login _just occurred_, or it happened five minutes ago! Ideas are greatly appreciated. Please note, I am NOT asking how to determine whether the user logged in _at some point_ in the recent past. I want to map the event itself. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: HtmlHelper does not like multiple URL parameters?
Ack, my post was auto-mangled. There is a difference there: vs. amp;. Try the Show original link on the post. On Jan 28, 12:08 am, Jeremy Burns jeremybu...@me.com wrote: Aren't those two outputs the same? Jeremy Burns On 28 Jan 2010, at 07:59, Johnny Cupcake wrote: My code (Cake 1.2.5): echo $html-url( array( 'controller' = 'users', 'action' = 'activate', '?' = array('e' = 'EMAIL', 'c' = 'CODE')), TRUE ); The output: http://localhost/index.php/users/activate?e=EMAILc=CODE This output is wrong, right? Should be: http://localhost/index.php/users/activate?e=EMAILc=CODE Workarounds? Must I use slashes as argument delimiters, or just build the URL myself? Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: HtmlHelper does not like multiple URL parameters?
I may do that...but I first want to know whether I am using these functions wrong, or they simply do not work as advertised. On Jan 28, 3:43 am, euromark dereurom...@googlemail.com wrote: why dont u use mod_rewrite and pretty urls instead? cleaner and much more fail proof anyway On 28 Jan., 10:00, Johnny Cupcake sparklew...@hotmail.com wrote: Ack, my post was auto-mangled. There is a difference there: vs. amp;. Try the Show original link on the post. On Jan 28, 12:08 am, Jeremy Burns jeremybu...@me.com wrote: Aren't those two outputs the same? Jeremy Burns On 28 Jan 2010, at 07:59, Johnny Cupcake wrote: My code (Cake 1.2.5): echo $html-url( array( 'controller' = 'users', 'action' = 'activate', '?' = array('e' = 'EMAIL', 'c' = 'CODE')), TRUE ); The output: http://localhost/index.php/users/activate?e=EMAILc=CODE This output is wrong, right? Should be: http://localhost/index.php/users/activate?e=EMAILc=CODE Workarounds? Must I use slashes as argument delimiters, or just build the URL myself? Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Pretty URLs don't work without .htaccess ?
Right, I was referring to mod_rewrite and not .htaccess in particular. I see the links generated by HtmlHelper are wrong too. They point to /app/webroot/filename when Apache's root is already set to /app/ webroot/, so they ought to therefore point to /filename. At this point I am only guessing the bug is related to not using mod_rewrite?! I see nothing in the docs about reconfiguring HtmlHelper's base directory, and I followed the instructions in the core app config file to no avail. I'm going to re-enable mod_rewrite and just pray all these problems disappear. On Jan 27, 4:34 pm, Miles J mileswjohn...@gmail.com wrote: Yes .htaccess is required because its uses mod_rewrite. If you didn't your URLs would be like so: index.php?url=/items/view/ On Jan 27, 1:18 pm, Johnny Cupcake sparklew...@hotmail.com wrote: This issue was last discussed here in 2006, as far as I can tell. I'd like to know if anything has changed since then. Are pretty URLs available without using .htaccess? For example, with my Apache document root set to my app's webroot dir, a controller items and an action view, and scaffolding on, I would expect something to be available athttp://myserver.com/items/view. But it is not; the result is a 404 error message. IOW, the example given in the book (http://book.cakephp.org/view/105/ Scaffolding) doesn't work. It DOES work if I tryhttp://myserver.com/index.php/items/view instead, but that isn't a very pretty URL. So I wonder, is there anything I can do short of turning on .htaccess, to make the clean/ pretty URLs available? Using Cake v1.2.5, that is. Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Pretty URLs don't work without .htaccess ?
Why did I disable mod_rewrite in the first place? Well, the core config file says pretty URLs are available regardless (see line 48), so I figured I'd keep complexity to a minimum. Having re-enabled mod_rewrite, both the problems I listed above are resolved. On Jan 28, 4:24 pm, AD7six andydawso...@gmail.com wrote: On 28 ene, 23:49, Johnny Cupcake sparklew...@hotmail.com wrote: Right, I was referring to mod_rewrite and not .htaccess in particular. I see the links generated by HtmlHelper are wrong too. They point to /app/webroot/filename when Apache's root is already set to /app/ webroot/, so they ought to therefore point to /filename. At this point I am only guessing the bug is related to not using mod_rewrite?! I see nothing in the docs about reconfiguring HtmlHelper's base directory, and I followed the instructions in the core app config file to no avail. I'm going to re-enable mod_rewrite and just pray all these problems disappear. Any path problems inevitably stem from having your config badly defined. Are pretty URLs available without using .htaccess? yes Are pretty URLs available without using mod_rewrite on apache? no Did you disable mod_rewrite for a reason? You can't achieve pretty urls without mod_rewrite or equivalent, and asking how to get pretty urls while actively preventing the possibility is a bit confusing. AD Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Pretty URLs don't work without .htaccess ?
This issue was last discussed here in 2006, as far as I can tell. I'd like to know if anything has changed since then. Are pretty URLs available without using .htaccess? For example, with my Apache document root set to my app's webroot dir, a controller items and an action view, and scaffolding on, I would expect something to be available at http://myserver.com/items/view . But it is not; the result is a 404 error message. IOW, the example given in the book (http://book.cakephp.org/view/105/ Scaffolding) doesn't work. It DOES work if I try http://myserver.com/index.php/items/view instead, but that isn't a very pretty URL. So I wonder, is there anything I can do short of turning on .htaccess, to make the clean/ pretty URLs available? Using Cake v1.2.5, that is. Thanks. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
HtmlHelper does not like multiple URL parameters?
My code (Cake 1.2.5): echo $html-url( array( 'controller' = 'users', 'action' = 'activate', '?' = array('e' = 'EMAIL', 'c' = 'CODE')), TRUE ); The output: http://localhost/index.php/users/activate?e=EMAILc=CODE This output is wrong, right? Should be: http://localhost/index.php/users/activate?e=EMAILc=CODE Workarounds? Must I use slashes as argument delimiters, or just build the URL myself? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Moving the SQL debug information from its default location
Wondering if there is some method of moving the SQL debug information from the bottom of the page with some kind of variable. This may be nitpicking, but I'm sort of irritated with how cake is placing it outside my /html tag. something like: ... default.ctp layout file ... ?php echo $debugInfo; ? /html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: 1.3 problem with baking from custom view template
Thanks, i missed those notes in the wiki about the template location when i read through it. I put the template files where they belong and now it works fine. On Sep 30, 12:56 am, mark_story mark.st...@gmail.com wrote: fired that last email off too quickly, also check thehttp://code.cakephp.org/wiki/1.3/migration-guide/bake-updatesnotes about bake as bake had a fairly significant set of changes done to it for 1.3 and the location of the templates has changed a bit. -Mark On Sep 29, 11:48 am, Johnny joh...@codynamic.com wrote: I recently started playin around with the 1.3 dev version of cake and i'm having problems with using custom view templates for bake. I place them in the app/vendors/shells/templates/views folder but bake ignores them and still uses the default templates that come with cake. In cake 1.2.5 everything works fine. I've read everything i could find about bake in 1.3 but can't seem to figure out what is wrong. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
1.3 problem with baking from custom view template
I recently started playin around with the 1.3 dev version of cake and i'm having problems with using custom view templates for bake. I place them in the app/vendors/shells/templates/views folder but bake ignores them and still uses the default templates that come with cake. In cake 1.2.5 everything works fine. I've read everything i could find about bake in 1.3 but can't seem to figure out what is wrong. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Prefix routing behavior is not OK
I found this article to be usefull regarding prefix routing: http://www.pagebakers.nl/2008/12/04/cakephp-router-and-prefixes/ It shows how you can get the right urls for paginator, links and forms using cake's prefix functionality. On Apr 12, 11:05 pm, Hazem Mohamed hazeim...@gmail.com wrote: Hi, I'm using cake for a while and have problems with prefix routing in every project I created. Its behavior is not what it should be. The following issues happened to me: * setting any other named params the prefix becomes one of the in the format $prefix:1. This makes some problem with pagination and I made seriously bad workarounds to get it working. * when I tried to make redirects and URLs to a plugin it does the same thing and the prefix became a named parameter. I tried many workarounds and changed many times and nothing changed. I tried to set prefix in the url array for different functions, in pagination urls everything failed to work with me. Do any one has a solution before sending a ticket in trac. Thanks in advance ans sorry for my poor English --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
custom routes issue
I have the following routes set up for the front end of my app: Router::connect('/become-our-client', array('controller' = 'users', 'action' = 'register')); Router::connect('/contact-us', array('controller' = 'contact', 'action' = 'contact_us')); Router::connect('/latest-projects', array('controller' = 'portfolio', 'action' = 'index')); Router::connect('/latest-projects/*', array('controller' = 'portfolio', 'action' = 'view')); Router::connect('/', array('controller' = 'pages', 'action' = 'display', 'home')); Router::connect('/*', array('controller' = 'pages', 'action' = 'display')); The problem i have is with the first two links, become-our-client and contact-us. Cake calls the pages controller instead of what i specified for these routes and returns a view not found error. The latest-projects link on the other hand works perfectly. I don't understand what the problem is, from what i've read about it and programmed so far in cake, the routes are parsed in the order they are declared in the routes.php file, so /contact-us should allways lead to what i've specified, and anything else in the form /* will be routed to the pages controller. If i leave the default route /pages/* it works fine but it is not an option for this project. I don't understand what the problem is, i've built similar routing rules for other apps i created in cake and never encountered such an issue. Could it be a bug with the latest cake 1.2.2.1820 stable version? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: scaffold
Scaffold is not supposed to be used in production environments. Use bake instead to physically create the model,view and controller files and edit those according to your needs. On Mar 20, 5:54 pm, Alejandro Weintz Aguilar alejan...@pixelestudios.com wrote: Hello, I am build a large proyect catalogs of product, like the scaffold feautures of Cake but need on UPDATE action to update a delete(varchar(1) field on the database not to delete the record. Also when it querys the record list to show all the record but the one with the delete field set to 1. The question is can I redefine scaffold functions? ty. -- PixelEstudios.com Alejandro Weintz Aguilar. Tel: (506)25920328 alejan...@pixelestudios.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Change view by userstate
if you are using the Auth component for user authentification, you can check if a user is logged in or not simply by using: $session-check('Auth.User.id') as a condition in your if clause On Feb 19, 5:19 pm, amarradi radis...@googlemail.com wrote: I found the solution I set an username on an variable, and after Logout this variable i set to null :) if(!empty($username)) { echo $html-link('Logout', array ('controller'='users','action'='logout'));} else { echo $html-link('Login', array ('controller'='users','action'='login'));} ? many greetings Marcus Radisch --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---