Re: Plugin assets not loading in production server
So many hours wasted with this... the development version was 2.1 and the uploaded version 2.2.1. Updating the bootstrap made it. At this point I think I will fully update to 2.2. Thanks chronon. El viernes, 28 de septiembre de 2012 01:58:36 UTC+2, chronon escribió: If you are using Cake 2.2.x, do you have this in your bootstrap.php? Configure::write('Dispatcher.filters', array( 'AssetDispatcher', 'CacheDispatcher')); See http://book.cakephp.org/2.0/en/appendices/2-2-migration-guide.htmlfor more info... On Thursday, September 27, 2012 12:48:05 PM UTC-7, Xoubaman wrote: The app is working with no issue in the development server (Windows), but not loading the plugin assets in production server (Linux). I get a controller not found error in each one. Some things I have out of a clean app or may be useful to know: - Plugins can be placed in Plugin folder or Modules folder. I have App::build(array('Plugin' = array(APP.'Modules'.DS))); in bootstrap. - Neither Plugin nor Module folder assets are being loaded (as an example, I can't access domain.com/debug_kit/css/debug_toolbar.css). - Base webroot assets are loaded correctly. - All app routes, included plugin ones, work fine (but look crappy without some css in the views). Trying to solve it, I deployed a fresh Cake install, created a test plugin with just one css file in Plugin/Test/webroot/css and loaded all plugins in bootstrap. I can see the css content in the url www.mydomain.com/test/css/file.css. In my app i'm not doing anything weird, just load assets with the paht or plugin notation, neither working. Any idea of what could be going on? -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Plugin assets not loading in production server
The app is working with no issue in the development server (Windows), but not loading the plugin assets in production server (Linux). I get a controller not found error in each one. Some things I have out of a clean app or may be useful to know: - Plugins can be placed in Plugin folder or Modules folder. I have App::build(array('Plugin' = array(APP.'Modules'.DS))); in bootstrap. - Neither Plugin nor Module folder assets are being loaded (as an example, I can't access domain.com/debug_kit/css/debug_toolbar.css). - Base webroot assets are loaded correctly. - All app routes, included plugin ones, work fine (but look crappy without some css in the views). Trying to solve it, I deployed a fresh Cake install, created a test plugin with just one css file in Plugin/Test/webroot/css and loaded all plugins in bootstrap. I can see the css content in the url www.mydomain.com/test/css/file.css. In my app i'm not doing anything weird, just load assets with the paht or plugin notation, neither working. Any idea of what could be going on? -- Like Us on FacekBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: Problem with Miles J. Uploader plugin and image name
3.5 El sábado, 5 de mayo de 2012 06:10:32 UTC+2, Miles J escribió: What version are you using? On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height
Re: What is the 2nd parameter for in the __ function?
In Cake = 2.0 the second (and further) params are used to replace the %s present in the first one, like in the sprintf PHP function. In Cake = 1.3 if you omit the second parameter the function will echo the first one, if you set it to true will return it as a string. El viernes, 4 de mayo de 2012 18:03:36 UTC+2, Daniel escribió: What is the 2nd parameter for in the __ function? I don't understand what it says in the manual. For example should I use: $this-Session-setFlash(__('User was not found.', true)); or just: $this-Session-setFlash(__('User was not found.')); ? Thanks, Daniel -- 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: Problem with Miles J. Uploader plugin and image name
Mmmm... sad that after try lots of things I missed one so obvious. But, now that the naming problem is solved, the thumb generation is producing an unexpected result, wrapping the image with smaller width and height into a black square of the passed mesaures Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg It will be nice to allow using the Uploader image functions isolated with custom images and not only after uploading them. Great plugin however, and thanks for the fast reply. El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió: Are you trying to overwrite the original image with the resized one? Try adding overwrite = true to the resize transformation. On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
What's the point with Cake's QA?
When I found that there is such a way to ask for help, I start to use it and answer the questions I know how to, moving my help activity from this group to QA. But, after some time, I realized that the QA service is quite abandoned, much less healthy than the google group and almost hidden in the Cake website (just a link in the top menu, whit the group much more visible an accesible). I think that centralize all in just one place (due to activity, this group) will be better than split the users in two sites. Not a big problem at all and no intention to blame anyone, just a personal thought. -- 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: What is the 2nd parameter for in the __ function?
Yes, it's ok. The point is, you can use __('User %s was not found.', $username) and the %s will be replaced with the value in $username, or with __('User %s from %s was not found.', $username, $country) you'll get, for example, User John from Jamaica was not found. El viernes, 4 de mayo de 2012 19:38:27 UTC+2, Daniel escribió: I'm using Cake 2.0, so this is OK, right? $this-Session-setFlash(__('User was not found.')); -- 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: Problem with Miles J. Uploader plugin and image name
After further investigation, the black square only apperas when the first resize operation actually takes place. If the source image is smaller than the max hegith and width, the thumb is correctly generated. If I add a third transform, with the same params as the second changing the append value only, the third image doesn't show the black part (unless the second algo has it). El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió: Mmmm... sad that after try lots of things I missed one so obvious. But, now that the naming problem is solved, the thumb generation is producing an unexpected result, wrapping the image with smaller width and height into a black square of the passed mesaures Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg It will be nice to allow using the Uploader image functions isolated with custom images and not only after uploading them. Great plugin however, and thanks for the fast reply. El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió: Are you trying to overwrite the original image with the resized one? Try adding overwrite = true to the resize transformation. On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Problem with Miles J. Uploader plugin and image name
After further investigation, the black square only apperas when the first resize operation actually takes place. If the source image is smaller than the max hegith and width, the thumb is correctly generated. If I add a third transform, with the same params as the second changing the append value only, the third image doesn't show the black part (unless the second algo has it). El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió: Mmmm... sad that after try lots of things I missed one so obvious. But, now that the naming problem is solved, the thumb generation is producing an unexpected result, wrapping the image with smaller width and height into a black square of the passed mesaures Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg It will be nice to allow using the Uploader image functions isolated with custom images and not only after uploading them. Great plugin however, and thanks for the fast reply. El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió: Are you trying to overwrite the original image with the resized one? Try adding overwrite = true to the resize transformation. On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió: Mmmm... sad that after try lots of things I missed one so obvious. But, now that the naming problem is solved, the thumb generation is producing an unexpected result, wrapping the image with smaller width and height into a black square of the passed mesaures Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg It will be nice to allow using the Uploader image functions isolated with custom images and not only after uploading them. Great plugin however, and thanks for the fast reply. El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió: Are you trying to overwrite the original image with the resized one? Try adding overwrite = true to the resize transformation. On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? El viernes, 4 de mayo de 2012 19:14:25 UTC+2, Xoubaman escribió: Mmmm... sad that after try lots of things I missed one so obvious. But, now that the naming problem is solved, the thumb generation is producing an unexpected result, wrapping the image with smaller width and height into a black square of the passed mesaures Here is a capture: http://i.minus.com/iMCU4QfzWadYN.jpg It will be nice to allow using the Uploader image functions isolated with custom images and not only after uploading them. Great plugin however, and thanks for the fast reply. El viernes, 4 de mayo de 2012 07:41:50 UTC+2, Miles J escribió: Are you trying to overwrite the original image with the resized one? Try adding overwrite = true to the resize transformation. On Thursday, May 3, 2012 9:49:21 AM UTC-7, Xoubaman wrote: This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name
Problem with Miles J. Uploader plugin and image name
This is my behavior setup: public $actsAs = array( 'Uploader.Attachment' = array( 'image_upload' = array( 'name'= 'formatFileName', 'baseDir'= IMAGES, 'uploadDir'= 'writers', 'dbColumn'= 'image', 'maxNameLength'= 200, 'overwrite' = true, 'transforms' = array( array('method' = 'resize', 'width' = IMAGE_WRITER_H, 'height' = IMAGE_WRITER_H, 'dbColumn' = 'image', 'append' = false), array('method' = 'resize', 'width' = IMAGE_WRITER_THUMB_W, 'height' = IMAGE_WRITER_THUMB_W, 'dbColumn' = 'thumb', 'append' = '_thumb') ) ) ) ); The problem is that the saved image in 'image' column is bowser-1.png, instead the expected bowser.png. The thumb works fine and is named bowser_thumb.png as expected. Any idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: hi need to maintain to layouts one for admin and one for remaining
In AppController::beforeFilter iif (isset($this-params['admin']) ($this-params['admin'] == 1)) { $this-layout = 'admin'; } This is for Cake 1.3, in Cake 2 I know $this-params has been replaced with other similar propertie. -- 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 Set library to build custom array
I have an array with this format: Array ( [0] = Array ( [0] = Array ( [year] = 2011 [month] = 8 ) ) ... with different combinations of years and months, ordered chronologically. I want to get an array that counts the number of month appearances in each year Array ( [2011] = Array ( [8] = 10 [7] = 15 ) -- 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: Using Set library to build custom array
Missclicked publish when writing ¬¬ The point is get the desired array without looping through the entire first array. Maybe is possible to begin with a better formatted array, i'm using this find to get it: $articles = $this-Article-find('all', array( 'fields' = array( 'YEAR(Article.publish_date) as year', 'MONTH(Article.publish_date) as month'), 'order' = array('year DESC, month DESC')) ); -- 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: Call paginator without limit option (special case)
Put your conditions in an array, then use the array for both pagination and find. $condtions = array(...); $this-paginate['conditions] = $conditions; $this-paginate(); $this-Model-find('all', array('conditions' = $conditions)); -- 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: Layout and Views
http://book.cakephp.org/view/1080/Layouts All your questions are answered there. -- 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: Element paths in a Plugin?
If you call for an element in a plugin, if cake don't found it in the plugin's element folder, will look for it in the app element folder. -- 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: Element paths in a Plugin?
It's what doc says, and, when I forgot to pass the plugin in an element call, Cake shows something like Can't find app/views/elements/name.ctp. But didn't properly try. -- 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: Using $this-set in view doesn't set the var
I think doc needs a correction then, as Var::set doesn't work exactly analogous to Controller::set. -- 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: 'Site under maintenance' option
I mean is my second option. I'm Spanish and made a literal translation of a Spanish expression, maybe it isn't correct in English. -- 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: Using $this-set in view doesn't set the var
I'm talking to correct this sentence (from http://book.cakephp.org/view/1086/set): In your view file you can do $this-set('activeMenuButton', 'posts'); *Then in your layout the $activeMenuButton variable will be available and contain the value 'posts'.* because it should say that the var will be available through $this-viewVars, not as a local variable. That's why I'm confused, I never really thought if it was possible or not. -- 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: Using $this-set in view doesn't set the var
I will suggest the correction to the documentation. Thanks for the answers! -- 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: Using $this-set in view doesn't set the var
http://api13.cakephp.org/class/view#method-Viewset http://book.cakephp.org/view/1086/set Someone of the core team answered that Var::set could be used to solve a similar issue in a post I here found when searching to my question. Don't remember the search subject now :( I mean cleaner in the sense of it's more readable one layout with some echo $var that another one with some echo $this-element(name, params stuff), almost in the application I'm developing. Maybe it's not the most elegant way, but, if we should not set vars in the views, why is still a method to do it? -- 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: 'Site under maintenance' option
Ip ranges is my B plan, but could be a problem with non-tech skilled admin users login from dinamic ips. I will come to this point later, so thanks for the answers, hope I can find a good solution. -- 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: Using $this-set in view doesn't set the var
I know it's possible to accomplish it like you said -and thanks for your answers and efforts to help, by the way-, but the basis of my question is why a documented view method it's not working as expected. I was trying my approach because I think it would be simplier and cleaner, to an unexperienced Cake user, edit or create layouts if he only have to echo a var instead an element with passed params. -- 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: 'Site under maintenance' option
I want that, when site is disabled, nobody will reach the login form whatever they do, unless the blessed ones who know the secret-and-only-path to do so. If everytime an user try to do some action that requires to be logged in, he's redirected to log in screen, the site won't look really disabled. The disabled boolean is read from database and loaded by a configuration helper (WebThecnick configuration plugin), that loads configuration values at the very beginning of AppController::beforeFilter, so secret route won't be available at routes.php. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Using $this-set in view doesn't set the var
My concrete case: In a CMS-like app, I have modules that can be attached to layout positions. Layout positions are vars echoed in each layout. So, I use a loader element, placed at the top of each layout, that should load each position var with his own output. Layout example: head ?php echo $this-elements('loader'); ? /head body ... ?php echo $position1; ? ... ?php echo $position2; ? ... /body Loader behavior: foreach ($modules as $position = $attached_modules) { foreach ($attached_modules as $model) { $output[$positions] .= $this-element($model); } $this-set($output); } Something like that. Code is not that way exactly, but I think it's enough to get the idea. The problem is that the $this-set at the bottom of loader element sets the var in viewVars attribute, but doesn't populate the vars to be accessed straight in the layout (as said in the doc, here: http://book.cakephp.org/view/1086/set) I know I could call each element in each position, but it will mess up the layout code and difficult creating or editing layouts, instead the elegant echo $position ^^ -- 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: Using $this-set in view doesn't set the var
Me neither, until now :) On the topic of setting vars in an element, regardless of it being wrong or not, the point is that it's possible. At least the doc says so, but it's not working for me (the Var::set() method). You may have an element that gets data from requestAction and, depending on the returned values, subsecuent layout contents will need different vars defined. -- 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
'Site under maintenance' option
I'm trying to implement a system to disable the site temporaly for maintenance purposes or whatever. If the site is disabled, only logged users can navigate through it, non-logged users are redirected to a Site under maintenance layout. Currently (o As of now), my approach is to allow a secret url that will lead to the login form, check in AppController::beforefilter if the current url is the allowed one and, if it isn't, set the maintenance layout. Trying to figure out how to allow only one url to log in, I came to define it as a constant in bootstrap and add the route in config/routes pointing to UsersController::login. It would be nice to save the secret url into the database and change it without editing bootstrap.php, though. Any suggestion? -- 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 $this-set in view doesn't set the var
I have an element in layout that generates some variables I want to use following parts of layout and view. As read in doc (http://book.cakephp.org/view/1086/set), using $this-set('varname', $value) will result in $varname available in the layout, but I'm getting a Undefined variable notice. debug($this-viewVars) before the var-generating element throws something like: Array ( [title_for_layout] = Awesome web [controller_set_var1] = lol [controller_set_var2] = foo ) Then, the element is echoed, and debugging $this-viewVars shows: Array ( [title_for_layout] = Awesome web [controller_set_var1] = lol [controller_set_var1] = lol [element_set_var] = gotcha! ) But $element_set_var stills undefined. Is this the normal behavior? Should I take $element_set_var manually from $this-viewVars? -- 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
Memory exhaustion issue with a single controller/model
I'm getting a exhausted memory fatal error when accessing a controller, no matter how many memory is set in php.ini (well, just set it to 500+ MB and get also exhausted, but I think it will consume all the memory in the universe). Following what AD7six said in http://groups.google.com/group/cake-php/browse_thread/thread/75b72a3808e2a7ca/d8d937a966751732?hl=enlnk=gstq=allocated+memory#d8d937a966751732 I put a debug(Debugger::trace()) near the crash line, and get the following: require - CORE\cake\libs\debugger.php, line 36 Configure::write() - CORE\cake\libs\configure.php, line 115 include - APP\config\core.php, line 36 Configure::__loadBootstrap() - CORE\cake\libs\configure.php, line 392 Configure::getInstance() - CORE\cake\libs\configure.php, line 52 include - CORE\cake\bootstrap.php, line 38 [main] - APP\webroot\index.php, line 76 Sadly, I don't get the point with this output. It doesn't look to involve model at all, does it? If I remove all the relations from the associated model, it works. It's not a heavy related model, just five belongsTo and one HABTM. But leaving uncommented just one relation gives back the memory problem. The action it's also empty, no query takes place, and every other controller works fine. Any idea? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: Convert Text to Images to Protect your Email from Search
It's a PHP task, not related to Cake. Take a look at http://www.php.net/manual/en/function.imagefttext.php On Oct 8, 10:39 am, hoss7 hoss...@gmail.com wrote: i need some helper for convert email to image, i am new in cakephp. 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: Am Stuck Need Help
1. Use nl2br PHP function in the view. You may also take a look at the sanitize class to prevent output problems: http://book.cakephp.org/view/1183/Data-Sanitization 2. In the action use set method (http://book.cakephp.org/view/1031/ Saving-Your-Data). You can also use a custom SQL query with $this- Modelname-query('sql') 3. http://book.cakephp.org/view/1411/File-Fields . You can save image's path or name in your database to access it easily. On Oct 8, 1:35 pm, tubiz tayi...@gmail.com wrote: Please i am working on a CakePHP application and i have some little problem. 1. I am trying to save some text into the database and would like to preserve the backspace as it is when it is displayed. 2. I also want to increase a field in the database table by one when an action is carried out, please how do i do these 3. How do i upload images using cakephp and display them as well. 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: handling an update
Try with the php key function: http://php.net/manual/en/function.key.php On Oct 4, 5:33 pm, james jamesliv...@googlemail.com wrote: hi im trying to update some data in a table and the array that holds the data looks like: $this-params['form'] - Array ( [9] = 1 [12] = 1 [14] = 1 [15] = 0 [16] = 0 [29] = 0 [28] = 0 [27] = 0 [26] = 0 [25] = 0 [30] = 0 [31] = 0 [32] = 0 ) what i need to do is update the field (a tinyint) where the id equals the array key but im not sure how to get each array key into a variable for the update. hope that makes sense but im not sure it does! cheers 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
How to make this query the Cake way?
Robot HABTM Tag User hasMany Robot Robot belongsTo User I want to get related robots based on his tags. More tags in common, more related. So, whats the way to put this query using $this-Robot-find(...) or $this-Robot-RobotsTag-find(...) SELECT count(tag_id) as total, Robots.*, Users.username FROM (`robots_tags` INNER JOIN robots ON (robots_tags.robot_id = robots.id)) INNER JOIN users ON robots.user_id=users.id WHERE tag_id IN (1,2,3) GROUP BY robot_id ORDER BY total DESC LIMIT 4 --~--~-~--~~~---~--~~ 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: Form helper not populating fields with accents
Ok, i'll try that. So, it's possible to assign the input's value using echo, but cake manages it other way and left the input empty due to a charset issue? Thanks to both. On Jul 23, 12:50 am, Mark dereurom...@googlemail.com wrote: yepp try it with mb_internal_encoding('UTF-8'); in the bootstrap.php + make sure, that all files containing hardcoded chars like é are saves as UTF8 (not ANSI, as Windows usually saves them) On 22 Jul., 23:50, Nejra mega...@gmail.com wrote: I had the same problem recently. I was using UTF-8 everywhere, but still got empty input fields. The solution was to enforce PHP's internal encoding to UTF-8 via some .htaccess (or Apache config) settings. You can find them here under step 3:http://developer.loftdigital.com/blog/php-utf-8-cheatsheet Hope this works for you as well. - Nejra On Jul 22, 8:29 pm, Xoubaman xouba...@gmail.com wrote: Not a charset problem, 99% confirmed. I try the following code to figure out what's happening: ?php debug($this-data['Profile']['last_name']); echo $form-text('Profile.last_name',array('label' = false)); ? input id=ProfileLastName type=text value=?php echo $this-data ['Profile']['last_name']; ? label= name=data[Profile][last_name]/ One text input using theformhelper and another one typing it classically. You can see an output screen capture athttp://yfrog.com/0wwtferij The same using UTF-8. Weird. On Jul 22, 1:00 am, Mark dereurom...@googlemail.com wrote: use utf8 throughout your website saves you usually a lot of trouble :) On 21 Jul., 23:34, Xoubaman xouba...@gmail.com wrote: Hello I'm having problems with theformhelper. When afieldcontains chars like ñ or vocals with accent, the value is not set to the corresponding input. ie, $this-data is Array ( [User] = Array ( [id] = 1 [username] = foo ) [Profile] = Array ( [id] = 1 [user_id] = 1 [first_name] = Carlos [last_name] = Gándara ) ) but echo $form-input('Profile.last_name',array('label' = false)); shows an empty textfield. In the layout i'm using $html-charset('ISO-8859-1'); but I don't think the problem is here because $this-data gets the correct value. Any idea? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: $this-data donot retreive any value
Try if($this-Note-save($this-data)) I suggest to go through the blog tutorial first of all (or just after read the basics of the manual) if you are new to Cake. On Jul 23, 4:39 pm, aswamr aswathi@gmail.com wrote: I am new to Cake PHP. Trying to create my first project with single table 'notes'. Following is my notes_controller which has add() function. function add() { if (!empty($this-data)) { echo if; if($this-Note-save($this-data['Note'])) { $this-flash('Your note has been updated.','/notes/'); } } else { echo else; echo $this-data['Note']['Note/title']; } } But even if i enter some valid data click 'save', it gets inside the else. It seems that $this-data donot get any data. What shall i do now? -- View this message in context:http://www.nabble.com/%24this-%3Edata-donot-retreive-any-value-tp2462... Sent from the CakePHP mailing list archive at Nabble.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: Form helper not populating fields with accents
Not a charset problem, 99% confirmed. I try the following code to figure out what's happening: ?php debug($this-data['Profile']['last_name']); echo $form-text('Profile.last_name',array('label' = false)); ? input id=ProfileLastName type=text value=?php echo $this-data ['Profile']['last_name']; ? label= name=data[Profile][last_name]/ One text input using the form helper and another one typing it classically. You can see an output screen capture at http://yfrog.com/0wwtferij The same using UTF-8. Weird. On Jul 22, 1:00 am, Mark dereurom...@googlemail.com wrote: use utf8 throughout your website saves you usually a lot of trouble :) On 21 Jul., 23:34, Xoubaman xouba...@gmail.com wrote: Hello I'm having problems with the form helper. When a field contains chars like ñ or vocals with accent, the value is not set to the corresponding input. ie, $this-data is Array ( [User] = Array ( [id] = 1 [username] = foo ) [Profile] = Array ( [id] = 1 [user_id] = 1 [first_name] = Carlos [last_name] = Gándara ) ) but echo $form-input('Profile.last_name',array('label' = false)); shows an empty text field. In the layout i'm using $html-charset('ISO-8859-1'); but I don't think the problem is here because $this-data gets the correct value. Any idea? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Form helper not populating fields with accents
Hello I'm having problems with the form helper. When a field contains chars like ñ or vocals with accent, the value is not set to the corresponding input. ie, $this-data is Array ( [User] = Array ( [id] = 1 [username] = foo ) [Profile] = Array ( [id] = 1 [user_id] = 1 [first_name] = Carlos [last_name] = Gándara ) ) but echo $form-input('Profile.last_name',array('label' = false)); shows an empty text field. In the layout i'm using $html-charset('ISO-8859-1'); but I don't think the problem is here because $this-data gets the correct value. Any idea? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Pagination with contain problem
User HABTM Group Group HABTM User When calling pagination I get these queries: SELECT COUNT(*) AS `count` FROM `groups` AS `Group` INNER JOIN `groups_users` AS `GroupsUser` ON (`GroupsUser`.`group_id` = `Group`.`id` AND `GroupsUser`.`user_id` = 1) WHERE 1 = 1 SELECT `Group`.`id`, `Group`.`name`, `Group`.`slug`, `Group`.`description`, `Group`.`image`, `Group`.`group_comment_count`, `Group`.`is_public`, `Group`.`created` FROM `groups` AS `Group` WHERE 1 = 1 ORDER BY `GroupsUser`.`created` DESC LIMIT 5 1054: Unknown column 'GroupsUser.created' in 'order clause' So, pagination is doing well the join with GroupsUser to count the number of records, but fails fetching the groups, although both queries should use the same paginate parameters. ¿I'm missing something? The code: $this-Group-unbindModel(array('hasAndBelongsToMany'=array ('User'))); $this-Group-bindModel(array('hasOne'=array('GroupsUser'=array ('foreignKey'=false,'type'='INNER','conditions'=array ('GroupsUser.group_id = Group.id','GroupsUser.user_id = '. $user_id); $parameters = array('contain' = array('GroupsUser'), 'order' = array('GroupsUser.created' = 'DESC'), 'limit' = $this-elementos_por_pagina); $this-paginate['Group'] = $parametros; $groups = $this-paginate('Group'); $this-set('groups', $groups); --~--~-~--~~~---~--~~ 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: Pagination with contain problem
$this-paginate['Group'] = $parametros; near the end is $this-paginate ['Group'] = $parameters; On May 28, 8:39 pm, Xoubaman xouba...@gmail.com wrote: User HABTM Group Group HABTM User When calling pagination I get these queries: SELECT COUNT(*) AS `count` FROM `groups` AS `Group` INNER JOIN `groups_users` AS `GroupsUser` ON (`GroupsUser`.`group_id` = `Group`.`id` AND `GroupsUser`.`user_id` = 1) WHERE 1 = 1 SELECT `Group`.`id`, `Group`.`name`, `Group`.`slug`, `Group`.`description`, `Group`.`image`, `Group`.`group_comment_count`, `Group`.`is_public`, `Group`.`created` FROM `groups` AS `Group` WHERE 1 = 1 ORDER BY `GroupsUser`.`created` DESC LIMIT 5 1054: Unknown column 'GroupsUser.created' in 'order clause' So, pagination is doing well the join with GroupsUser to count the number of records, but fails fetching the groups, although both queries should use the same paginate parameters. ¿I'm missing something? The code: $this-Group-unbindModel(array('hasAndBelongsToMany'=array ('User'))); $this-Group-bindModel(array('hasOne'=array('GroupsUser'=array ('foreignKey'=false,'type'='INNER','conditions'=array ('GroupsUser.group_id = Group.id','GroupsUser.user_id = '. $user_id); $parameters = array('contain' = array('GroupsUser'), 'order' = array('GroupsUser.created' = 'DESC'), 'limit' = $this-elementos_por_pagina); $this-paginate['Group'] = $parametros; $groups = $this-paginate('Group'); $this-set('groups', $groups); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How manage triple relation between Model in CAKEPHP?
And, if you have three habtm relations between model 1 and model2? On May 15, 5:56 pm, AD7six andydawso...@gmail.com wrote: On May 15, 5:32 pm, marco.rizze...@gmail.com marco.rizze...@gmail.com wrote: Hi I have three model that have a triple relation between them. How can I manage this triple relation between Model in CAKEPHP? via belongsTo, hasMany and a model for each table - the usual way. hth, AD --~--~-~--~~~---~--~~ 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: requestAction and parameters
Maybe you are mixing requestAction with passing parameters to an element. Try $this-requestAction('controller_name/count/5'); Look at the API entry for requestAction: http://api.cakephp.org/class/object#method-ObjectrequestAction On Mar 25, 11:32 pm, Fran Iglesias cakephpi...@gmail.com wrote: Hi, I have a doubt with requestAction and passing parameters to the action. The cookbook doesn't state it clear enough for me. If you have a controller action like this: function recent($count = null) {...} and you call it using requestAction with a parameter... $this-requestAction(array('action' = 'recent', 5)); then you don't get 5 in the $count variable in the action. You can find in $this-params[0]. Is this the expected behavior? TIA --- Fran Iglesias cakephpi...@gmail.comhttp://cakephpilia.blogspot.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: Why is it so hard to find answers on cakephp trouble?
I absolutely agreed with thalund, te cookbook is a nightmare for newbies, with lots of holes here and there. In fact, lots of common questions only get response in personal blogs (ie habtm with extra fields). That doesn't say any good about the doc. Although this group is a very good place to get answers. On Mar 26, 10:00 am, Affinity goo...@affinitywebsolutions.co.uk wrote: I find support not great... I have asked a few questions on various forums and got no reply to any, so I have had to struggle through on my own. Its not a great way to get people into it. Although I started trying to learn Zend and did find CakePHP documentation/examples better. I'm also surprised Google groups is the primary forum... the google forum is rubbish compared to leading forum systems these days so I have no idea why we're all on here! --~--~-~--~~~---~--~~ 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: Why is it so hard to find answers on cakephp trouble?
I like fairies! But i'm not an expert in Cake and fear to do something wrong. Pasting other people work doesn't look ethical either, but I'll try to add the habtm with extra fields :) On Mar 26, 11:28 am, AD7six andydawso...@gmail.com wrote: On Mar 26, 11:15 am, Xoubaman xouba...@gmail.com wrote: I absolutely agreed with thalund, te cookbook is a nightmare for newbies, with lots of holes here and there. In fact, lots of common questions only get response in personal blogs (ie habtm with extra fields). That doesn't say any good about the doc. Any time you see something missing in the cookbook, find the answer elsewhere and don't update the cookbook - a fairy dies. Won't someone please think of the fairies. AD --~--~-~--~~~---~--~~ 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: controller not being detected when view index file is in sub dir of /views
If you have created subfolders inside the controller's view folder, I think you have to set the viewpath variable. Maybe in the controller with $this-viewPath = 'folder' http://api.cakephp.org/search/viewpath On Mar 26, 12:05 pm, John Andersen j.andersen...@gmail.com wrote: Please confirm that your view is to be found in the directory path / views/controller/action.ctp, where controller = your controllers name, and action.ctp = your controllers action that you invoked in the browser. Best wishes, John On Mar 26, 8:43 am, programguru ja...@w3developing.com wrote: does anyone know why my view/sub1/sub2/filename.ctp cannot access the controller which is in my /controllers dir? I tested everything to ensure my MVC code was correct in /view/sub1 and all was OK, but when I drop one level deeper in views it seems to disconnect and connection to my controller. Anyone know a fix for this? I've been through the only cake forum, manual, and searched google, but have not found anything that works as of yet. i would appreciate any tips, suggestions or the right direction. Thanks. -- View this message in context:http://n2.nabble.com/controller-not-being-detected-when-view-index-fi... Sent from the CakePHP mailing list archive at Nabble.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 -~--~~~~--~~--~--~---
Sluggable behaviour issue
Using the sluggable behaviour http://bakery.cakephp.org/articles/view/sluggable-behavior I get this error: Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 393216 bytes) in ...\app\models\behaviors\sluggable.php on line 291 Looks like the utf8 array is too big. Commenting it and forcing to use the iso translation solves the problem, but I don't know if it's a common problem or something weird is happening in my application. I waste several hours with this thinking the problem was in the redirect function :( --~--~-~--~~~---~--~~ 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: Retrieve Associated Count
The counterCache field is updated with each insert or delete (maybe more often), so if your boxes are changing allt he time, it will not be a problem. If it isn't the case, you can fetch all the boxes and their count and take only the count81 using a foreach loop. On Mar 17, 5:17 pm, Tony Thomas truet...@gmail.com wrote: I have a simple hasMany relationship set up with CakePHP and I want to retrieve a couple of fields from the parent table based on the count of the child. The scenario: I have boxes that hold 81 aliquots each. (Each box is 9X9.) I want to retrieve the id and description from the boxes table of boxes that have fewer than 81 aliquots to generate a list. In other words, I want a list of boxes that are not full. My models: class Box extends AppModel { var $name = 'Box'; var $hasMany = array('Aliquot'); var $belongsTo = 'Freezer'; } class Aliquot extends AppModel { var $name = 'Aliquot'; var $belongsTo = array('Box','Specimen'); } I can't seem to work out the best way to get a count of the aliquots for each box. I haven't been working with CakePHP all that long, so I'm hoping there's a relatively simple way to do this that I'm missing. It doesn't seem like a very complicated thing to do, yet I've spent the better part of my morning working on it with not success. This seems like it would work: http://book.cakephp.org/view/75/Saving-Your-Data#counterCache-Cache-y... Except that my tables are already populated, so creating the aliquot_count field in my boxes table just leaves me with a bunch of empty fields. Does anyone have some advice that will point me in the right direction? --~--~-~--~~~---~--~~ 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?
You can model it like a normal HABTM relationship with an extra field named main_photo. On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote: My articles have and belong to many photos. This is so when the photo is seen somewhere else on the site, I can have a see related articles. Each article also has one main photo. I can't seem to figure out the syntax for this in APP/models/article.php file and in APP/models/photo.php. --~--~-~--~~~---~--~~ 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: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?
Just model it like a normal HABTM relationship, no special syntaxis, and add the field in the database. When saving, try this: http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/ I haven't done it before, so i can't secure his fiability, but looks good. On Mar 11, 10:38 am, mattalexx mattal...@gmail.com wrote: What's the syntax for adding an extra field to the $hasAndBelongsToMany var? Thank you for you response. On Mar 11, 2:43 am, Xoubaman xouba...@gmail.com wrote: You can model it like a normal HABTM relationship with an extra field named main_photo. On Mar 11, 8:30 am, mattalexx mattal...@gmail.com wrote: My articles have and belong to many photos. This is so when the photo is seen somewhere else on the site, I can have a see related articles. Each article also has one main photo. I can't seem to figure out the syntax for this in APP/models/article.php file and in APP/models/photo.php. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Paginate this, please
Instead of putting here a bunch of code of my own, I'll ask you to tell me the way you'd manage this: Robot hasMany Rating Robot has many other models linked. Robot has some fields with info. Rating has id, rating (integer), user_id and created I want to paginate all robots' fields with their average rating from a week to now without quering any other model than Rating. --~--~-~--~~~---~--~~ 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: Paginate this, please
After some desperating waste of hours, I've found (¿?) a solution Instead of paginate the Robot model, I paginate the Rating model containing Robot: $this-paginate = array('Rating' = array('fields' = array('AVG(Rating.rating) AS range_avg', 'Robot.*'), 'conditions' = array('Rating.created ' = date('Y-m-d', strtotime (-1 week))), 'limit' = 10, 'group' = array('Rating.robot_id'), 'order' = array('range_avg' = 'desc'), 'contain' = array('Robot'))); The resulting query works fine and I have my robots sorted by their range_avg, but a problem solved implies new wild problems: the paginator does'nt paginate anything. Im my view i have $nav_pags = $paginator-prev('', null, '').' '.$paginator-numbers (); $nav_pags .= ' '.$paginator-next('', null, '').'br /'; but nav_pags is empty. I've considered override the paginate method as said in the custom query part of the doc, but in the same view I want to show the robots filtered by average ratings (avg) or number of uses (count), and can not override the method twice. Suggestions? Sorry for possible english mistakes. On Mar 10, 12:51 pm, Xoubaman xouba...@gmail.com wrote: Instead of putting here a bunch of code of my own, I'll ask you to tell me the way you'd manage this: Robot hasMany Rating Robot has many other models linked. Robot has some fields with info. Rating has id, rating (integer), user_id and created I want to paginate all robots' fields with their average rating from a week to now without quering any other model than Rating. --~--~-~--~~~---~--~~ 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: Newbie to MVC and CakePHP question on CRUD / Associations
Use the console to generate basic crud actions for your models. You can generate the models also. The code will be simple enough to get a idea about how cake works. On Mar 6, 4:53 pm, a_summer asummer.mob...@gmail.com wrote: Good Day, Thank you for taking the time to read this discussion. I am new to MVC design, and I need to understand how to create a view/ controller that will insert records into a model that uses the hasMany association. The table layout and code for the models is below: MySQL DB Create Table [solutions] CREATE TABLE `solutions` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255) default NULL, `teaser` text, `user_id` int(11) default NULL, `status_id` int(11) default NULL, `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC [sections] CREATE TABLE `sections` ( `id` int(11) NOT NULL auto_increment, `title` text, `content` text, `solution_id` int(11) default NULL, `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 Models ?php # /apps/models/solution.php class Solution extends AppModel { var $name = 'Solution'; #Validations var $validate = array ( 'title' = array ( 'rule' = 'notEmpty' ), 'user_id' = array ( 'rule' = 'notEmpty' ), 'teaser' = array ( 'rule' = 'notEmpty' ), 'status_id' = array ( 'rule' = 'notEmpty' ) ); #Associations var $hasMany = array ( 'Section' = array ( 'className' = 'Section', 'foreignKey' = 'solution_id', 'order' = 'Section.created ASC', 'dependent' = true ) ); } ? ++ ?php # /apps/models/section.php class Section extends AppModel { var $name = 'Section'; #Validations var $validate = array ( 'title' = array ( 'rule' = 'notEmpty' ), 'content' = array ( 'rule' = 'notEmpty' ), 'solution_id' = array ( 'rule' = 'notEmpty' ) ); #Associations var $belongsTo = array ( 'Solution' = array ( 'className' = 'Solution', 'foreignKey' = 'solution_id' ) ); } ? Now, in my old and flawed method of coding, I would include a form with a hidden field that includes the solution_id. Since I am trying to understand MVC, I know I will need a view to manage the input form for inserting a new section. But I am stuck on the controller ... how do I ensure that the controller includes the correct solution_id? Thanks in advance for any assistance you can provide! A Summer --~--~-~--~~~---~--~~ 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: multiple file include...
Edit the default layout at app\views\layouts\default.ctp and add a element (at app\views\elements) placing it where you want. You can access de data from the db using the element's requestAction method. Read http://book.cakephp.org/view/94/Views On Mar 6, 9:35 pm, ashutosh ashutosh.dhi...@gmail.com wrote: hi all, I was trying cakePHP to make my site. this side has left side bar which picks the catalog data from db and the middle content depending upon the some other parameter. Left side bar will always be same format and will be picked up from db. any idea how should i do that? i am new to cakePHP. I want to create that Left side bar as other file and include in main and middle part in other file and include in main file any suggestion?? --~--~-~--~~~---~--~~ 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: Newbie to MVC and CakePHP question on CRUD / Associations
Whit the console, specifically with the bake shell, you can set up the database configuration, generate the models automatically from the tables, the controllers with crud actions and the views for this actions. Look at http://book.cakephp.org/view/108/the-cakephp-console, http://book.cakephp.org/view/113/Code-Generation-with-Bake and http://www.archive.org/details/SettingUpTheCakephpConsoleOnWindows if you are in windows. On Mar 7, 12:11 am, A Summer asummer.mob...@gmail.com wrote: Thank you for your response. Do you mean use the cake bake scaffold thingy to generate a scaffold? On Fri, Mar 6, 2009 at 11:17 AM, Xoubaman xouba...@gmail.com wrote: Use the console to generate basic crud actions for your models. You can generate the models also. The code will be simple enough to get a idea about how cake works. On Mar 6, 4:53 pm, a_summer asummer.mob...@gmail.com wrote: Good Day, Thank you for taking the time to read this discussion. I am new to MVC design, and I need to understand how to create a view/ controller that will insert records into a model that uses the hasMany association. The table layout and code for the models is below: MySQL DB Create Table [solutions] CREATE TABLE `solutions` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255) default NULL, `teaser` text, `user_id` int(11) default NULL, `status_id` int(11) default NULL, `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC [sections] CREATE TABLE `sections` ( `id` int(11) NOT NULL auto_increment, `title` text, `content` text, `solution_id` int(11) default NULL, `created` datetime default NULL, `modified` datetime default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1 Models ?php # /apps/models/solution.php class Solution extends AppModel { var $name = 'Solution'; #Validations var $validate = array ( 'title' = array ( 'rule' = 'notEmpty' ), 'user_id' = array ( 'rule' = 'notEmpty' ), 'teaser' = array ( 'rule' = 'notEmpty' ), 'status_id' = array ( 'rule' = 'notEmpty' ) ); #Associations var $hasMany = array ( 'Section' = array ( 'className' = 'Section', 'foreignKey' = 'solution_id', 'order' = 'Section.created ASC', 'dependent' = true ) ); } ? ++ ?php # /apps/models/section.php class Section extends AppModel { var $name = 'Section'; #Validations var $validate = array ( 'title' = array ( 'rule' = 'notEmpty' ), 'content' = array ( 'rule' = 'notEmpty' ), 'solution_id' = array ( 'rule' = 'notEmpty' ) ); #Associations var $belongsTo = array ( 'Solution' = array ( 'className' = 'Solution', 'foreignKey' = 'solution_id' ) ); } ? Now, in my old and flawed method of coding, I would include a form with a hidden field that includes the solution_id. Since I am trying to understand MVC, I know I will need a view to manage
Re: Adding multiple tags at the same time
Still don't working The content of $this-data is Array ( [Robot] = Array ( [name] = robotname [description] = robotdescription ) [Tag] = Array ( [0] = Array ( [id] = 6 [tag] = tag1 ) [1] = Array ( [id] = 7 [tag] = tag2 ) [2] = Array ( [tag] = tag3 ) ) ) I save using $this-Robot-saveAll($this-data) and got these queries: START TRANSACTION INSERT INTO `robots` (`name`, `description`) VALUES ('robotname', 'robotdescription') SELECT LAST_INSERT_ID() AS insertID SELECT `RobotsTag`.`tag_id` FROM `robots_tags` AS `RobotsTag` WHERE `RobotsTag`.`robot_id` = 2 COMMIT The models relations are: class Tag extends AppModel { var $name = 'Tag'; var $hasAndBelongsToMany = array( 'Robot' = array('className' = 'Robot', 'joinTable' = 'robots_tags', 'foreignKey' = 'tag_id', 'associationForeignKey' = 'robot_id', 'unique' = true, ); } class Robot extends AppModel { var $name = 'Robot '; var $hasAndBelongsToMany = array( 'Tag' = array('className' = 'Tag', 'joinTable' = 'robots_tags', 'foreignKey' = 'robot_id', 'associationForeignKey' = 'tag_id', 'unique' = true, ) ); What I am doing 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 -~--~~~~--~~--~--~---
Contain is not working with pagination
I'm trying to paginate my robots filtering the data with two named parameters in the url. In the controller I build the paginate var manually (and i think that with no errors), but, when paginating, the contain doesn't work and no data is retrieved. The paginate var, obtained with $this-set('paginate',$this- paginate); at the controller and debug($paginate); in the view, looks that way: Array ( [Robot] = Array ( [limit] = 4 [contain] = Array ( [0] = Rating ) [fields] = Array ( [0] = Robot.* [1] = AVG(Rating.rating) AS average_rating ) [order] = Array ( [average_rating] = desc ) [conditions] = Array ( [Rating.created ] = 2009-02-03 [Robot.is_public] = 1 ) ) [RobotComment] = Array ( [order] = Array ( [RobotComment.created] = desc ) [limit] = 4 ) ) I think the build is correct, but I got this sql errors: SELECT `Robot`.*, AVG(`Rating`.`rating`) AS average_rating, `Robot`.`id` FROM `robots` AS `Robot` WHERE `Rating`.`created` '2009-02-03' AND `Robot`.`is_public` = 1 ORDER BY `average_rating` desc LIMIT 4 I know that the use of avg is incorrect, but the point is why the table rating is not in the FROM clausule and there are no joins. Once contain works, I will manage the avg problem. The complete code, with model relations and the paginate build process is here: http://bin.cakephp.org/saved/43314 --~--~-~--~~~---~--~~ 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 tags at the same time
That is how it looks like, I paste a previous debug instead the proper one (sorry :P). Disabling the redirect lines the debugger shows this queries: INSERT INTO `robots` (`name`, `description`, `content`, `is_public`, `created`) VALUES ('as', 'asdasda', 'sfasfasf', 1, '2009-02-27 11:16:31') SELECT LAST_INSERT_ID() AS insertID SELECT `RobotsTag`.`tag_id` FROM `robots_tags` AS `RobotsTag` WHERE `RobotsTag`.`robot_id` = 7 (I previously omitted some fileds to clean the code) On Feb 27, 1:28 am, mscdex msc...@gmail.com wrote: On Feb 26, 7:12 pm, Xoubaman xouba...@gmail.com wrote: I'm sure there is a more elegant way to do this (or simply actually do this). Any suggestions? Try getting rid of the second Tag subarray, so that it looks like this: Array ( [Robot] = Array ( [name] = The name [description] = The description ) [Tag] = Array ( [0] = Array ( [id] = tag1 ) [1] = Array ( [id] = tag2 ) ) ) --~--~-~--~~~---~--~~ 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 1.2 Auth component not logging in
User table got username and password? Beforefilter ir correct? Do you allow the public actions in your controller? Auth is tricky, but following the tutorial step by step should work. On Feb 27, 4:40 pm, aka marcelgre...@gmail.com wrote: I keep running in to this problem over and over again. Whenever I implement the cakephp 1.2 Auth component I can't login (and yes, I'm sure the login credentials are right). The password is saved with the sha1 algorithm and the salt value has been changed. New cake installation + a new database (workflow: setting up the db + tables, using the cake console to bake the necessary m/c/v's ) But when ever I try to log in I get the 'Login failed. Invalid username or password.' message. Really hope someone can help me out here! Thanx --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Routing passing non-route variables to actions
In my application, I want the route /user/Homer/robots to show all Homer's robots, wich are retrieved by the action get_robots from users_controller. The problem is that get_robots has some variables that are not passed in the route: function get_robots($model = null, $id = null, $show_all = true) So, what can I do to give a value to $model and $show_all through the routing (the $id will be Homer). The (incomplete) entry in routes.php is: Router::connect('/user/:username/robots', array('controller' = 'users', 'action' = 'get_robots'), array('pass' = array('username'), 'username' = '[0-9a-zA-Z]*' ) ); --~--~-~--~~~---~--~~ 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 tags at the same time
In my application, I intend to upload a robot with multiple tags simultaneously. For that purpose I use the following form: echo $form-create('Robot', array('id' = 'RobotUploadForm', 'action' = '/upload'));? echo $form-input('name'); echo $form-input('description'); echo $form-input('Tag.all',array('type' = 'text', 'label' = 'Tags (separate with comas)')); echo $form-end('Submit'); and get the tags this way: [Tag] = Array ( [all] = tag1, tag2 ) In order to save all the tags at one shot, I rebuild $this-data to look like this: Array ( [Robot] = Array ( [name] = The name [description] = The description ) [Tag] = Array ( [0] = Array ( [Tag] = Array ( [id] = tag1 ) ) [1] = Array ( [Tag] = Array ( [id] = tag2 ) ) ) ) But when I try to save, using $this-Robot-save($this-data), only de robot's data is saved, despite the doc saying that Cake should save the HABTM relation. Btw, all models and tables are properly modelized. The upload function: function upload() { if (!empty($this-data)) { debug($this-data); $tags = split(',',$this-data['Tag']['all']); $i=0; foreach ($tags as $tag) { $tag_array[$i]['id']=trim($tag); $i++; } unset($this-data['Tag']['all']); $this-data['Tag'] = $tag_array; if ($this-Robot-save($this-data)) { $this-Session-setFlash(__('The robot has been saved', true)); $this-redirect(array('action'='index')); } else { $this-Session-setFlash(__('The robot could not be saved. Please, try again.', true)); } } } I'm sure there is a more elegant way to do this (or simply actually do this). Any suggestions? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using pagination inside elements
Including the helper in the AppController works with the missed indexes, but navigating through the pages causes new problems with the sessions and/or renders the element twice. By the moment I'll left apart the AJAX pagination, other things need my atention now. Thanks for the help, doc. On Feb 3, 12:13 am, dr. Hannibal Lecter lecter...@gmail.com wrote: Xoubaman, use var $helpers = array(..., 'Paginator'); in your AppController. make sure you fetch your data by using $this-paginate() in your controller to avoid the undefined indexes you're getting. Don't use renderElement() it has been deprecated, useelement() instead. Hope that will set you on the right track. On Feb 2, 6:16 pm, Xoubaman xouba...@gmail.com wrote: I've discovered the view method renderElement, that has a parameter called loadHelpers, false but default, that looked good. But it doesn't work. Thepaginatorhelper isn't loaded and I'm getting the same odd undefined indexes notices. The renderElement method isn't properly explained neither in the doc or the api, so I don't know if it's useful, deprecated or whatever. If i can't use thepaginatorinside anelement, I think is far away from the shining proclamed in the doc :( On Jan 30, 11:54 am, Xoubaman xouba...@gmail.com wrote: Some progress: adding thepaginatorhelper to the helpers array avoid the call to a memeber function in a non-object, but thepaginator doesn't paginate anything. In each helper call an undefined index error is shown. Notice (8): Undefined index: pageCount [CORE\cake\libs\view\helpers \paginator.php, line 476] Notice (8): Undefined index: count [CORE\cake\libs\view\helpers \paginator.php, line 416] ... Any idea? Note that thepaginatorhelper must be added to the items controller, not the item_comments controller. On Jan 30, 1:10 am, dr. Hannibal Lecter lecter...@gmail.com wrote: This is just a wild guess, but perhaps it is not applied when you're using requestAction()? It is (if I understand correctly) a separate request as far as cake is concerned. Try adding thepaginatormanually in your controller, and if that doesn't work maybe someone else will offer more help. On Jan 29, 10:06 pm, Xoubaman xouba...@gmail.com wrote: I edited some code to make it more readable in the group, looks like that is a misstip. The requestAction works fine, in fact if I comment all $paginatormentions the foreach shows the expected results. The doc reads that setting var $paginate and using the method paginate () automatically adds the PaginationHelper. On Jan 29, 8:50 pm, dr. Hannibal Lecter lecter...@gmail.com wrote: Well, maybe you didn't include the PaginatorHelper in your app. Other thing which seems odd to me is that your controller is ItemsComments, but in yourelementyou're calling $this-requestAction('items/get_comments/'.$id). Is 'items/get_comments/' properly mapped to ItemsComments::index()? On Jan 29, 7:22 pm, Xoubaman xouba...@gmail.com wrote: I'm trying to code anelementthat shows the comments about a certain item, but when I'm using thepaginatorhelper i get a Fatal error: Call to a member function numbers() on a non-object in[...] message. Searching the group i found that some users had the same problem, but never received a valid answer, so... let's try again. The code: CONTROLLER: class ItemsCommentsController extends AppController { function index($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid Item.', true)); $this-redirect(array('action'='index')); } $comments = $this-paginate('ItemComment', array ('ItemComment.item_id =' = $id)); if(isset($this-params['requested'])) { return $comments;} $this-set('comments', $comments); } } VIEW: echo $this-element('item_comments',array('id'=$item['Item']['id'])); ELEMENT: ?php $comments = $this-requestAction('items/get_comments/'.$id); ? ?php echo $paginator-numbers(); ? echo $paginator-prev('« Previous ', null, null, array('class' = 'disabled')); echo $paginator-next(' Next »', null, null, array('class' = 'disabled')); foreach ($comments as $comment){ echo 'br /User: '.$comment['User']['username']).'br /'; echo $comment['ItemComment']['content'].'br /'; } ? --~--~-~--~~~---~--~~ 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
Re: Using pagination inside elements
I've discovered the view method renderElement, that has a parameter called loadHelpers, false but default, that looked good. But it doesn't work. The paginator helper isn't loaded and I'm getting the same odd undefined indexes notices. The renderElement method isn't properly explained neither in the doc or the api, so I don't know if it's useful, deprecated or whatever. If i can't use the paginator inside an element, I think is far away from the shining proclamed in the doc :( On Jan 30, 11:54 am, Xoubaman xouba...@gmail.com wrote: Some progress: adding thepaginatorhelper to the helpers array avoid the call to a memeber function in a non-object, but thepaginator doesn't paginate anything. In each helper call an undefined index error is shown. Notice (8): Undefined index: pageCount [CORE\cake\libs\view\helpers \paginator.php, line 476] Notice (8): Undefined index: count [CORE\cake\libs\view\helpers \paginator.php, line 416] ... Any idea? Note that thepaginatorhelper must be added to the items controller, not the item_comments controller. On Jan 30, 1:10 am, dr. Hannibal Lecter lecter...@gmail.com wrote: This is just a wild guess, but perhaps it is not applied when you're using requestAction()? It is (if I understand correctly) a separate request as far as cake is concerned. Try adding thepaginatormanually in your controller, and if that doesn't work maybe someone else will offer more help. On Jan 29, 10:06 pm, Xoubaman xouba...@gmail.com wrote: I edited some code to make it more readable in the group, looks like that is a misstip. The requestAction works fine, in fact if I comment all $paginatormentions the foreach shows the expected results. The doc reads that setting var $paginate and using the method paginate () automatically adds the PaginationHelper. On Jan 29, 8:50 pm, dr. Hannibal Lecter lecter...@gmail.com wrote: Well, maybe you didn't include the PaginatorHelper in your app. Other thing which seems odd to me is that your controller is ItemsComments, but in yourelementyou're calling $this-requestAction('items/get_comments/'.$id). Is 'items/get_comments/' properly mapped to ItemsComments::index()? On Jan 29, 7:22 pm, Xoubaman xouba...@gmail.com wrote: I'm trying to code anelementthat shows the comments about a certain item, but when I'm using thepaginatorhelper i get a Fatal error: Call to a member function numbers() on a non-object in[...] message. Searching the group i found that some users had the same problem, but never received a valid answer, so... let's try again. The code: CONTROLLER: class ItemsCommentsController extends AppController { function index($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid Item.', true)); $this-redirect(array('action'='index')); } $comments = $this-paginate('ItemComment', array ('ItemComment.item_id =' = $id)); if(isset($this-params['requested'])) { return $comments;} $this-set('comments', $comments); } } VIEW: echo $this-element('item_comments',array('id'=$item['Item']['id'])); ELEMENT: ?php $comments = $this-requestAction('items/get_comments/'.$id); ? ?php echo $paginator-numbers(); ? echo $paginator-prev('« Previous ', null, null, array('class' = 'disabled')); echo $paginator-next(' Next »', null, null, array('class' = 'disabled')); foreach ($comments as $comment){ echo 'br /User: '.$comment['User']['username']).'br /'; echo $comment['ItemComment']['content'].'br /'; } ? --~--~-~--~~~---~--~~ 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: if then isn't working
echo(trtd width='225px') only happens if $j==4, but echo(/ td/tr); happens in every first bucle iterations, so you are closing lots os rows and columns. On Jan 31, 3:56 pm, thankyou gregbo...@gmail.com wrote: ** im a beginner :) I'm trying to get this to make 20 rows of 5 colums each and I'm continuing to get errors. Any idea what's wrong? Here's the code: table width='100%' border='0' tr td width='100%' align='center' table ?php $text = ' area code'; for($i = 0; $i 10; $i++) { for($j = 0; $j 10; $j++) { if($j == 4) { echo(trtd width='225px'); } echo($html-link($firstNumber . $i. $j . $text , /AreaCodes/ detail/. $firstNumber . $i. $j, array('class'='area_code_link'))); echo(nbsp;nbsp;nbsp;nbsp;nbsp;); } echo(/td/tr); } ? /table /td /tr /table ? } ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using pagination inside elements
Some progress: adding the paginator helper to the helpers array avoid the call to a memeber function in a non-object, but the paginator doesn't paginate anything. In each helper call an undefined index error is shown. Notice (8): Undefined index: pageCount [CORE\cake\libs\view\helpers \paginator.php, line 476] Notice (8): Undefined index: count [CORE\cake\libs\view\helpers \paginator.php, line 416] ... Any idea? Note that the paginator helper must be added to the items controller, not the item_comments controller. On Jan 30, 1:10 am, dr. Hannibal Lecter lecter...@gmail.com wrote: This is just a wild guess, but perhaps it is not applied when you're using requestAction()? It is (if I understand correctly) a separate request as far as cake is concerned. Try adding the paginator manually in your controller, and if that doesn't work maybe someone else will offer more help. On Jan 29, 10:06 pm, Xoubaman xouba...@gmail.com wrote: I edited some code to make it more readable in the group, looks like that is a misstip. The requestAction works fine, in fact if I comment all $paginator mentions the foreach shows the expected results. The doc reads that setting var $paginate and using the method paginate () automatically adds the PaginationHelper. On Jan 29, 8:50 pm, dr. Hannibal Lecter lecter...@gmail.com wrote: Well, maybe you didn't include the PaginatorHelper in your app. Other thing which seems odd to me is that your controller is ItemsComments, but in your element you're calling $this-requestAction('items/get_comments/'.$id). Is 'items/get_comments/' properly mapped to ItemsComments::index()? On Jan 29, 7:22 pm, Xoubaman xouba...@gmail.com wrote: I'm trying to code an element that shows the comments about a certain item, but when I'm using the paginator helper i get a Fatal error: Call to a member function numbers() on a non-object in[...] message. Searching the group i found that some users had the same problem, but never received a valid answer, so... let's try again. The code: CONTROLLER: class ItemsCommentsController extends AppController { function index($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid Item.', true)); $this-redirect(array('action'='index')); } $comments = $this-paginate('ItemComment', array ('ItemComment.item_id =' = $id)); if(isset($this-params['requested'])) { return $comments;} $this-set('comments', $comments); } } VIEW: echo $this-element('item_comments',array('id'=$item['Item']['id'])); ELEMENT: ?php $comments = $this-requestAction('items/get_comments/'.$id); ? ?php echo $paginator-numbers(); ? echo $paginator-prev('« Previous ', null, null, array('class' = 'disabled')); echo $paginator-next(' Next »', null, null, array('class' = 'disabled')); foreach ($comments as $comment){ echo 'br /User: '.$comment['User']['username']).'br /'; echo $comment['ItemComment']['content'].'br /'; } ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using pagination inside elements
I'm trying to code an element that shows the comments about a certain item, but when I'm using the paginator helper i get a Fatal error: Call to a member function numbers() on a non-object in[...] message. Searching the group i found that some users had the same problem, but never received a valid answer, so... let's try again. The code: CONTROLLER: class ItemsCommentsController extends AppController { function index($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid Item.', true)); $this-redirect(array('action'='index')); } $comments = $this-paginate('ItemComment', array ('ItemComment.item_id =' = $id)); if(isset($this-params['requested'])) { return $comments;} $this-set('comments', $comments); } } VIEW: echo $this-element('item_comments',array('id'=$item['Item']['id'])); ELEMENT: ?php $comments = $this-requestAction('items/get_comments/'.$id); ? ?php echo $paginator-numbers(); ? echo $paginator-prev('« Previous ', null, null, array('class' = 'disabled')); echo $paginator-next(' Next »', null, null, array('class' = 'disabled')); foreach ($comments as $comment){ echo 'br /User: '.$comment['User']['username']).'br /'; echo $comment['ItemComment']['content'].'br /'; } ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Using pagination inside elements
I edited some code to make it more readable in the group, looks like that is a misstip. The requestAction works fine, in fact if I comment all $paginator mentions the foreach shows the expected results. The doc reads that setting var $paginate and using the method paginate () automatically adds the PaginationHelper. On Jan 29, 8:50 pm, dr. Hannibal Lecter lecter...@gmail.com wrote: Well, maybe you didn't include the PaginatorHelper in your app. Other thing which seems odd to me is that your controller is ItemsComments, but in your element you're calling $this-requestAction('items/get_comments/'.$id). Is 'items/get_comments/' properly mapped to ItemsComments::index()? On Jan 29, 7:22 pm, Xoubaman xouba...@gmail.com wrote: I'm trying to code an element that shows the comments about a certain item, but when I'm using the paginator helper i get a Fatal error: Call to a member function numbers() on a non-object in[...] message. Searching the group i found that some users had the same problem, but never received a valid answer, so... let's try again. The code: CONTROLLER: class ItemsCommentsController extends AppController { function index($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid Item.', true)); $this-redirect(array('action'='index')); } $comments = $this-paginate('ItemComment', array ('ItemComment.item_id =' = $id)); if(isset($this-params['requested'])) { return $comments;} $this-set('comments', $comments); } } VIEW: echo $this-element('item_comments',array('id'=$item['Item']['id'])); ELEMENT: ?php $comments = $this-requestAction('items/get_comments/'.$id); ? ?php echo $paginator-numbers(); ? echo $paginator-prev('« Previous ', null, null, array('class' = 'disabled')); echo $paginator-next(' Next »', null, null, array('class' = 'disabled')); foreach ($comments as $comment){ echo 'br /User: '.$comment['User']['username']).'br /'; echo $comment['ItemComment']['content'].'br /'; } ? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---