Re: Keeping unbindModel out of your controllers
On 16/dic/06, at 08:35, Mariano Iglesias wrote: > http://bakery.cakephp.org/articles/view/185 btw bakery says invalid article.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Keeping unbindModel out of your controllers
On 16/dic/06, at 08:35, Mariano Iglesias wrote: > [snip] > Again, your old way of calling (through arrays) WILL STILL work. > > I've just made the change since I wanted to clean up my controller > code even > further. So those "two or three logical lines" can turn into "one" > logical > line ;) ok, I'm losing my senses again ;) thanks for your work. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: Keeping unbindModel out of your controllers
Thanks mate. I just improved the code even further. Updating your code with the new version doesn't require you to do any modifications to your existing expects() call, so it is upgrade safe. The article: http://bakery.cakephp.org/articles/view/185 Contains the code update and explanation (look for section titled "Making multiple expects() in one call." As a short preview, when we used to do something like: $this->Post->Author->expects(); $this->Post->Category->expects(); $this->Post->PostDetail->expects(array('PostExtendedDetail', 'PostAttachment')); We can now do in just one call: $this->Post->expects('Author.Author', 'Category.Category', 'PostDetail.PostExtendedDetail', 'PostDetail.PostAttachment'); Another example, version 1 form: $this->Title->expects(array('Story', 'Post')); $this->Title->Post->expects(array('User')); New form: $this->Title->expects('Story', 'Post.User'); Again, your old way of calling (through arrays) WILL STILL work. I've just made the change since I wanted to clean up my controller code even further. So those "two or three logical lines" can turn into "one" logical line ;) -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Mikee Freedom Enviado el: Viernes, 15 de Diciembre de 2006 03:43 a.m. Para: cake-php@googlegroups.com Asunto: Re: Keeping unbindModel out of your controllers it has to be said - you rock! I was just at the point that I thought some of my controllers looked extremely unwieldy due to the bindModel and unbindModel calls I was making. Now with 2 or 3 logical lines everything stays nice and clean and my DB requests are always the size they need to be. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problems to get cake running
the above explanation are enough I guess just a small adition. the files in View folder can be shown directly, cake renders them. webroot is the folder where actually the server lands in. so basically if you put some file in webroot folder you should be able to access it typing the url in browser. For example ..u keep a file foo.html in /cake/app/webroot/foo.html in browser you would be able to access the page by typing http://localhost/cake/foo.html :) hope that helps ...happy baking!!! Suman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Three seemingly unrelated questions from a Cake n00b
1. If you are not going to reuse the app or no one other than you is going to modify the site settings like EMAIL, MAX_ITEMS etc its better to have a seperate table in DB and MVC for that. And in the controllers you are going to use those constants, fetch those data in the before filter of the controller. Let me show u an example : pageTitle = $this->Settings->getPageTitle()." : ".$this->name; $this->clientmail = $this->Settings->getWebmasterEmail(); } /*~~*/ //Admin Functions /*~~*/ ~ controller = &$controller; $Setting = new Setting; $this->siteSettings = $Setting->findById(1); } function getPageTitle(){ $Setting = new Setting; $siteSettings = $Setting->findById(1); return $siteSettings['Setting']['title']; } function getWebmasterEmail(){ $Setting = new Setting; $siteSettings = $Setting->findById(1); return $siteSettings['Setting']['webMasterEmail']; } But there might be more elegant way though but the above works he he. 2. Scaffolding is just scaffolding only, not meant for production use. As mentioned by woodman use bake to create the code and then customize. Good Luck!!! and happy baking :) Suman --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Three seemingly unrelated questions from a Cake n00b
He Jeff, I can point you in the right direction on a few of these. Drop downs are generally created using helpers, specifically: HtmlHelper::selectTag with 2nd param being: array $optionElements Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element But of course, if you're using scaffolding, you won't have a proper view to use these in! Indeed, as with your last point, I think your only solution is to move onto creating your own MVC classes. You don't have to start this from scratch though - Cake comes with a command line php script called Bake, which essentially makes models/views/controllers which behave like scaffolding, ready for you to customize. Good luck! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Three seemingly unrelated questions from a Cake n00b
1. app/config/core.php is a good place to define your constants 2. Use beforeScaffold to manipulate your data 3. see 2. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect problem
Sorry, I copied it from my .htaccess in your case it should be RewriteCond %{REQUEST_URI} !^/app/webroot/login --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: redirect problem
If you use the default cake directory structure, add RewriteCond %{REQUEST_URI} !^/app/webroot/utils to app/webroot/.htaccess --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Three seemingly unrelated questions from a Cake n00b
Greetings ladies and gentlemen, I am trying to put together my very first quasi-real cake app (in that I'm just using it for the admin side of a site) and so far I've run into a couple of things that I'd like to do that I can't figure out. One, I'd like to be able to add new constants. Usually I define things like SITE_EMAIL or ERROR_EMAIL, MAX_ITEMS_PER_PAGE, etc., and I'd like to have that available in my Cake App too. Two, I have a field that is going to probably be a select box, but the two options are never going to change or be added to. I could make a table with the two possible options, and have cake do all the magic in my scaffolding, but I hoped there was a way to do a similar thing with an array. i.e. I would define some kind of array in the model or the controller, and on the list page, instead of seeing a bunch of 1s or 2s I would see "1 day course" or "2 day course". Hopefully this makes a little sense... Three, I was noticing that the list page of the scaffolding would pretty much be exactly the html I'd want for my own list page, except that no one really wants to look at the Id field in the list. Is there a way to remove that from the default scaffold view? Thanks for hearing me out, Jeff Day --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help with a moderately complex query
Hi Chris, To my knowledge, use of SQL min(members), or any other SQL aggregate function, will only be stored in index [0] of the results array - I was looking for something similar in a post named 'Output format of findAll': http://groups.google.com/group/cake-php/browse_thread/thread/aa19397789bd7425/bcca7c16d04cdbca?lnk=gst&q=findAll+nice+output&rnum=1#bcca7c16d04cdbca In fact, even when I went as far as aliasing the aggregate function to a field name in the model (i.e SUM(`Model`.quantity) as `quantity`), the result still goes in the 0 index, rather than the ModelName index. The only new idea I've had about this was to use the array format for passing SQL params to findAll, as Cake generally seems to understand these better. Apart from that, I don't think you've got a choice but to put the stuff from index [0] into the [ModelName] field yourself with an ugly and hard to maintain loop through the results set. If you do end up doing this, learn from my mistakes, and from CakeBaker's blog, and put it direct in the model rather than the Controller, as this makes it a bit more readable and keeps your controllers cleaner. This whole issue of using aggregate functions led me into some crazy array formats, which I went on a rant about in this post: "Passing data to the view in a nice way?" http://groups.google.com/group/cake-php/browse_thread/thread/ecdd0bcffcd6f5b6 I think I scared my fellow Bakers off with that! Sorry I can't be more help, please let me know if you find some nicer solutions! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problems to get cake running
Make sure you have enabled the rewrite module in your httpd.conf. \xampp\apache\conf\httpd.conf ... around LINE 118 just delete the # infront of the line. That should do it. - J On Dec 15, 2:48 pm, "moonraker" <[EMAIL PROTECTED]> wrote: > Hi guys, > > i'm very interested in cakephp and tried to get it running on my local > webserver (a xampp under winxp). > > I've putted the cake files under localhost/cake so that for example > "app" is under localhost/cake/app. > > Afterwards i tried to do the "Cake Blog Tutorial" and exactly followed > the tutorial but the application isn't running, i only get the "Missing > controller" information site > (http://img436.imageshack.us/img436/4200/cakenr1.jpg)! > > Is there any other special reason which i have to consider? > > Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Okay, my fault, I gave you the wrong syntax. This: should be: I'm actually surprised that didn't give you a syntax error, now that I think about it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Was "French speaking bakers only" - Cakephp-fra dead -> Long live cakephp-fr !
The former group was dead and posts seemed not to find their ways so: If you're a french speaker and think sometimes easing-up cakephp's group by asking basic questions (like I might), or adressing cakephp's french specific issues, in french is a good idea, cakephp-fr is a group for you! [EMAIL PROTECTED] Miam miam (yummy yummy) ! bruno. PS: if you want to bash our semi-gods or just wanna say few supporting words in any language you're more than welcome too! ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: French speaking bakers only - Cakephp-fra down?
Probably tell him: "whatever dude, go learn symfony" ;) -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Bruno Baudry Enviado el: Viernes, 15 de Diciembre de 2006 07:49 p.m. Para: cake-php@googlegroups.com Asunto: Re: French speaking bakers only - Cakephp-fra down? Mariano Iglesias a écrit : > What about I think Zinedine Zidane was right to head that Italian dude? ;) Well, the dude said to his hears: "ya mother can't bake!" what would have you done?! ;-) BB --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to make findAll() return object?
I have been playing around a bit more with the mapping. Seems save works just fine. Check out http://bin.cakephp.org/saved/1237 This version, I added another property to AppModel to turn the objects on and off. I notices a problem with generateList() and some other model methods that expect arrays. So, by simply setting objectify = true when we need it, we can make sure there are no problems. There is plenty more we can do. Mapping submitted form data to an object to make saving it easier might be nice. Anyway, just some ideas to play around with. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Problems to get cake running
On Dec 15, 2006, at 3:48 PM, moonraker wrote: > > Hi guys, > > i'm very interested in cakephp and tried to get it running on my local > webserver (a xampp under winxp). > > I've putted the cake files under localhost/cake so that for example > "app" is under localhost/cake/app. > > > Afterwards i tried to do the "Cake Blog Tutorial" and exactly followed > the tutorial but the application isn't running, i only get the > "Missing > controller" information site ( > http://img436.imageshack.us/img436/4200/cakenr1.jpg )! > > Is there any other special reason which i have to consider? The URL should be: http://localhost/cake/posts/ (if you're using mod_rewrite) or http://localhost/cake/index.php/posts/ (if you aren't. Make sure to tell /app/config/core.php if you aren't.) Try that. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Problems to get cake running
Hi guys, i'm very interested in cakephp and tried to get it running on my local webserver (a xampp under winxp). I've putted the cake files under localhost/cake so that for example "app" is under localhost/cake/app. Afterwards i tried to do the "Cake Blog Tutorial" and exactly followed the tutorial but the application isn't running, i only get the "Missing controller" information site ( http://img436.imageshack.us/img436/4200/cakenr1.jpg )! Is there any other special reason which i have to consider? Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Okay maybe you can help me understand that then as well because I don't think I am understanding that part right. Sorry :( I know you have helped me out a lot and it doesn't go unappericated trust me I am greatful for the help but I think this is the part that I been having a majority of problems on. Changed the View to how we talked but it displays the Category in the 1st row of the table and the second row gets nothign but errors ... but it reconizes that there is two entries in the notes table. *sigh* - J On Dec 15, 2:01 pm, "nate" <[EMAIL PROTECTED]> wrote: > Okay, both the result data and the queries being executed look correct > now. Going based off of that, you should have no trouble fixing the > array index issues in the view. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
Mariano Iglesias a écrit : > What about I think Zinedine Zidane was right to head that Italian dude? ;) Well, the dude said to his hears: "ya mother can't bake!" what would have you done?! ;-) BB --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Okay, both the result data and the queries being executed look correct now. Going based off of that, you should have no trouble fixing the array index issues in the view. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
fais como vocè quizer rapais! Ismael S. Kafeltz a écrit : > Já que tá todo mundo falando uma mistura de línguas, eu acho que vou > começar a falar em português pra deixar a coisa mais engraçada, que > tal? > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Re: Parsing the date from the HTML form helper
http://api.cakephp.org/classController.html#43aea5e84ef8550cf3ae8a97ca18ec1e On 12/15/06, Samuel DeVore <[EMAIL PROTECTED]> wrote: > you know about this right > > $this->cleanUpFields(); > > Sam D > > On 12/15/06, Rolo D. Monkey <[EMAIL PROTECTED]> wrote: > > > > I have this code in app/app_model.php. It parses the separate date > > fields created by $html->yearOptionTag(), $html->monthOptionTag, etc. > > and formats them to be put in a DATETIME column. > > > > It is a problem that comes up often enough that I think it might be > > useful to have this somewhere in the core. If not in Model then > > somewhere in the HTML form helper. Let me know what you think. > > > > function _getDate($model, $field) { > > > > $hour = isset($this->data[$model][$field . '_hour']) ? > > intval($this->data[$model][$field . '_hour']) : null; > > $min = isset($this->data[$model][$field . '_min']) ? > > intval($this->data[$model][$field . '_min']) : null; > > $sec = isset($this->data[$model][$field . '_sec']) ? > > intval($this->data[$model][$field . '_sec']) : null; > > $month = isset($this->data[$model][$field . '_month']) ? > > intval($this->data[$model][$field . '_month']) : null; > > $day = isset($this->data[$model][$field . '_day']) ? > > intval($this->data[$model][$field . '_day']) : null; > > $year = isset($this->data[$model][$field . '_year']) ? > > intval($this->data[$model][$field . '_year']) : null; > > > > return date('Y-m-d H:i:s', mktime($hour, $min, $sec, $month, $day, > > $year)); > > > > } // end function _getDate() > > > > > > > > > > > > > -- > == > S. DeVore > (the old fart) the advice is free, the lack of crankiness will cost you > -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Parsing the date from the HTML form helper
you know about this right $this->cleanUpFields(); Sam D On 12/15/06, Rolo D. Monkey <[EMAIL PROTECTED]> wrote: > > I have this code in app/app_model.php. It parses the separate date > fields created by $html->yearOptionTag(), $html->monthOptionTag, etc. > and formats them to be put in a DATETIME column. > > It is a problem that comes up often enough that I think it might be > useful to have this somewhere in the core. If not in Model then > somewhere in the HTML form helper. Let me know what you think. > > function _getDate($model, $field) { > > $hour = isset($this->data[$model][$field . '_hour']) ? > intval($this->data[$model][$field . '_hour']) : null; > $min = isset($this->data[$model][$field . '_min']) ? > intval($this->data[$model][$field . '_min']) : null; > $sec = isset($this->data[$model][$field . '_sec']) ? > intval($this->data[$model][$field . '_sec']) : null; > $month = isset($this->data[$model][$field . '_month']) ? > intval($this->data[$model][$field . '_month']) : null; > $day = isset($this->data[$model][$field . '_day']) ? > intval($this->data[$model][$field . '_day']) : null; > $year = isset($this->data[$model][$field . '_year']) ? > intval($this->data[$model][$field . '_year']) : null; > > return date('Y-m-d H:i:s', mktime($hour, $min, $sec, $month, $day, > $year)); > > } // end function _getDate() > > > > > -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Okay I changed the way I associate the tables in the models. Changed it to the way you mentioned and I agree simple is just easier ... isn't that why we have CakePHP? :P I am using the latest copy of CakePHP on the site. By doing that right away I saw a change but yet I still get that index error( like the one I mentioned previously). Now it displays to 2 sections in the category view for the Test Category before it was only doing one and it also now displays the Array reflecting the notes instead of the Categories array. -- Array ( [Category] => Array ( [id] => 1 [title] => Test Category ) [Note] => Array ( [0] => Array ( [id] => 1 [title] => Test Note [body] => Testing to see if this works :) [created] -00-00 [modified] -00-00 [category_id] => 1 ) [1] => Array ( [id] => 2 [title] => Another Test Note [body] => Testing body of note [created] -00-00 [modified] -00-00 [category_id] => 1 ) ) ) -- Here is the query: -- Nr Query 1 DESC `categories` 2 DESC `notes` 3 SELECT `Category`.`id`, `Category`.`title` FROM `categories` AS `Category` WHERE (`Category`.`id` = 1) LIMIT 1 4 SELECT `Note`.`id`, `Note`.`title`, `Note`.`body`, `Note`.`created`, `Note`.`modified`, `Note`.`category_id` FROM `notes` AS `Note` WHERE `Note`.`category_id` = '1' -- You assume correct about my class names and model file. - J On Dec 15, 1:05 pm, "nate" <[EMAIL PROTECTED]> wrote: > Well, I tend to favor my way of doing it, since Cake will always fill > in the defaults. It's always better to keep things simple, especially > when adding complexity is redundant. > > Also, I'm assuming your model file and class names are both singular? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Textarea limit
you do need javascript for that. nothing native in HTML (like maxlength) for a textarea. On 16/12/06, phpjoy <[EMAIL PROTECTED]> wrote: > > hey guys, > > how do you limit and check the textareas? > do you make javascripts for that? > > kinda new to cakephp. > > yossi > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to make findAll() return object?
Also, here is a fun idea, which can be used for alll models if or individual models depending on your preference. http://bin.cakephp.org/saved/700 Remember, all we are really doing here is converting arrays to objects, so you can access them more easily. The next step is to use these converted objects when saving. We could probably work together a reverse map in beforeSave to see how well it works. In my tests, I have not seen any slowdown in making these maps happen. I would be interested in hearing about other results. @anselm Doing the hide stuff would be something you would want to implement directly in your model or AppModel if all your models need it. The fetch is already handled by findAll. It seems that you want to have direct access to the model from your view. We are more inclined towards sending just the Set data to the view rather than the whole model object. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Textarea limit
hey guys, how do you limit and check the textareas? do you make javascripts for that? kinda new to cakephp. yossi --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: acl.php
I'm having exactly the same problem -- I'm running 1.1.11.4064, and I have the fixes in from trunk for acl.php and error.php to stop those errors. My installation is set up so that multiple apps share a single cake folder, and I wonder if that's the problem. I'm wondering if acl.php doesn't deal correctly with the -app switch right now or something. bake.php doesn't seem to have any trouble with it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to make findAll() return object?
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/set.php#L86 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Well, I tend to favor my way of doing it, since Cake will always fill in the defaults. It's always better to keep things simple, especially when adding complexity is redundant. Also, I'm assuming your model file and class names are both singular? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Parsing the date from the HTML form helper
I have this code in app/app_model.php. It parses the separate date fields created by $html->yearOptionTag(), $html->monthOptionTag, etc. and formats them to be put in a DATETIME column. It is a problem that comes up often enough that I think it might be useful to have this somewhere in the core. If not in Model then somewhere in the HTML form helper. Let me know what you think. function _getDate($model, $field) { $hour = isset($this->data[$model][$field . '_hour']) ? intval($this->data[$model][$field . '_hour']) : null; $min = isset($this->data[$model][$field . '_min']) ? intval($this->data[$model][$field . '_min']) : null; $sec = isset($this->data[$model][$field . '_sec']) ? intval($this->data[$model][$field . '_sec']) : null; $month = isset($this->data[$model][$field . '_month']) ? intval($this->data[$model][$field . '_month']) : null; $day = isset($this->data[$model][$field . '_day']) ? intval($this->data[$model][$field . '_day']) : null; $year = isset($this->data[$model][$field . '_year']) ? intval($this->data[$model][$field . '_year']) : null; return date('Y-m-d H:i:s', mktime($hour, $min, $sec, $month, $day, $year)); } // end function _getDate() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
hmm I think I have done that. In my first post I posted this: Notes Model: -- var $name = 'Note'; var $belongsTo = array ('Category' => array( 'className' => 'Category', 'conditions' =>'', 'order' =>'', 'foreignKey' => 'category_id') ); Category Model: - var $name = 'Category'; var $hasMany = array ('Note' => array( 'className' => 'Note', 'conditions' =>'', 'order' =>'', 'foreignKey' => 'category_id') ); Is this not right? Should I change it to the way you said so cakephp handles it on its own? On Dec 15, 12:15 pm, "nate" <[EMAIL PROTECTED]> wrote: > Yes, you're missing something fairly important: you didn't actually > associate your models with each other, so Cake has no idea that you > also want Notes when you ask for Categories. Your model classes should > look a little something like the following: > > class Category extends AppModel { > var $name = 'Category'; > var $hasMany = 'Note'; > > }class Note extends AppModel { > var $name = 'Note'; > var $belongsTo = 'Category'; > > } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Dependent model, call delete model
I don't know this for sure but it would be a place to start. I would guess that the beforeDelete callback for your Photo Model will be called even though the records are being deleted as dependent associations of your Album. I would put your file delete method in your beforeDelete callback of your Photo Model and see how that works. If not, you might have to call the method manually from the beforeDelete callback of your Album model. again, i haven't tested this theory but based on my small experience with Cake I would have said it would do this successfully. cheers, mikee On 16/12/06, 2000Man <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a model Photalbums and a model Photo's. Photo's have a entry in > the database, but also a imagefile on the filesystem. Photomodel has > his own method delete, which deletes the database entry > (parent::delete) as well as the imagefile. > > In photoalbums, the relationship is set to dependent=true. This works > more or less: when I delete a photoalbum, the associated photos are > deleted from the database. > > But what I would like is that the method delete from this model is > being used, instead of just generating the mysql queries. Is the > already possible, or would it otherwise be usefull to add this > functionality? > > Tnxs in advance, > 2000Man > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: How to make findAll() return object?
Is the map thing implemented anything like what I submitted befote? Just to see if I was on the right track or something... By the way, sounds pretty cool... So should us be expecting a lot of this handy utilities like Set, Sanitize, etc. etc. etc. ? Sounds freaking awesome. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de nate Enviado el: Viernes, 15 de Diciembre de 2006 11:11 a.m. Para: Cake PHP Asunto: Re: How to make findAll() return object? Cake 1.2 has not been officially released yet, but it has a core class called Set, which allows you to map query results onto an object. The syntax for that is: $this->set('posts', Set::map($this->Post->findAll())); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: French speaking bakers only - Cakephp-fra down?
What about I think Zinedine Zidane was right to head that Italian dude? ;) -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de bruno Enviado el: Viernes, 15 de Diciembre de 2006 02:27 p.m. Para: Cake PHP Asunto: Re: French speaking bakers only - Cakephp-fra down? nate a écrit : > Vive la France! Nate, actullaly that's all the french you need to be able to post into the french group ;-) > Let me be the first to say 'let them eat Cake!' ;-) Yes! you know we like our food... :-D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: French speaking bakers only - Cakephp-fra down?
Did you say something like: "Now that everyone is speaking a mixture of languages, I will begin to speak in Portuguese to leave the thing more *complex*, what's up?" I never learned Portuguese or anything, but I speak Spanish and they say for Spanish speakers it should be easy to understand, so I was testing... So? Was I close? -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Ismael S. Kafeltz Enviado el: Viernes, 15 de Diciembre de 2006 03:31 p.m. Para: Cake PHP Asunto: Re: French speaking bakers only - Cakephp-fra down? Já que tá todo mundo falando uma mistura de línguas, eu acho que vou começar a falar em português pra deixar a coisa mais engraçada, que tal? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Yes, you're missing something fairly important: you didn't actually associate your models with each other, so Cake has no idea that you also want Notes when you ask for Categories. Your model classes should look a little something like the following: class Category extends AppModel { var $name = 'Category'; var $hasMany = 'Note'; } class Note extends AppModel { var $name = 'Note'; var $belongsTo = 'Category'; } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Re: Documentation for rdBaker
Ok you have no cred! lol http://irc.cakephp.org/ is a web based one. to play. you might go to the http://cakeforge.org/projects/rdos/ site and make a request to join. Sam D On 12/15/06, Rolo D. Monkey <[EMAIL PROTECTED]> wrote: > > I know this is going to ruin my geek cred, but despite the fact that I > have been on the net since 1992, I never really used IRC. > > Also, I do not have command line access to my server, and from what I > have seen this seems to be the preferred way to access the Bake class. > > I am willing to help with documentation. Where should it go? > > > > > -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Documentation for rdBaker
I know this is going to ruin my geek cred, but despite the fact that I have been on the net since 1992, I never really used IRC. Also, I do not have command line access to my server, and from what I have seen this seems to be the preferred way to access the Bake class. I am willing to help with documentation. Where should it go? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Alrighty, I set DEBUG to 2 and this is what I get 1 SELECT `Category`.`id`, `Category`.`title` FROM `categories` AS `Category` WHERE (`Category`.`id` = 1) LIMIT 1 I am now getting that error again though @ localhost/categories/view/1: Notice: Undefined index: title in ... Notice: Undefined index: id in ... Am I missing something? You can see why this is really confusing for me ... I have read almost every tutorial gone thru the manual and done numerious serches on the net to see why I can't get this to work. What else could be wrong? Is it not possible to list the Notes in the Category view? This is just so fustrating :( Nate thank you once again for your help I am just clueless on why this thing wont work. - J On Dec 15, 11:30 am, "nate" <[EMAIL PROTECTED]> wrote: > Okay, since you added this: > > > This: > link($row['Note']['title'], > '/notes/view/'.$row['Note']['id']) ?> > becomes > link($row['title'], '/notes/view/'.$row['id']) ?> > > Also, what version of Cake are you on? Even if if there are no Notes > results, there should still be an empty array nested under Category. > Get the latest version of Cake, and turn DEBUG up to 2, so you can see > what queries are being executed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Okay, since you added this: This: link($row['Note']['title'], '/notes/view/'.$row['Note']['id']) ?> becomes link($row['title'], '/notes/view/'.$row['id']) ?> Also, what version of Cake are you on? Even if if there are no Notes results, there should still be an empty array nested under Category. Get the latest version of Cake, and turn DEBUG up to 2, so you can see what queries are being executed. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Documentation for rdBaker
There is documentation on the irc in the form of an auto-repsonding bot named 'gwoo' if the bot is online just say 'gwoo: I have a question about rdBaker' you have to use those exact words or it will respond with some snarky sarcastic tones. Ignore the tones and launch into your questions. Actually no I do not think there is a lot of documentation, heck I don't know how up to date gwoo has been keeping it, you might want to use the scripts/bake.php script in the cake core, it works nicely even if it is a little annoying ;) Sam D ps the first paragraph is a JOKE On 12/15/06, Rolo D. Monkey <[EMAIL PROTECTED]> wrote: > > In general CakePHP is a godsend, and I am planning on using it a lot, > but the documentation leaves something to be desired. Is there a way I > can help? > > Is there any documentation for rdBaker? After some tweaking, I got it > to work, but the index.thtml is looking for a 'created' field in my > table. My table does not have this field. Are there certain required > fields other than 'id' that I should know about? > > > > > -- == S. DeVore (the old fart) the advice is free, the lack of crankiness will cost you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Documentation for rdBaker
In general CakePHP is a godsend, and I am planning on using it a lot, but the documentation leaves something to be desired. Is there a way I can help? Is there any documentation for rdBaker? After some tweaking, I got it to work, but the index.thtml is looking for a 'created' field in my table. My table does not have this field. Are there certain required fields other than 'id' that I should know about? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Okay well I did that and it only displays the Category Names now. I did a pr($data) and it came up with this: -- Array ( [Category] => Array ( [id] => 1 [title] => Test Category ) ) -- The View now looks like this: -- Title Created Actions link($row['Note']['title'], '/notes/view/'.$row['Note']['id']) ?> link('View', '/notes/view/'.$row['Note']['id']) ?> | link('Edit', '/notes/edit/'.$row['Note']['id']) ?> | link('Delete', '/notes/delete/'.$row['Note']['id'], null, 'Are you sure you want to delete "'.$row['Note']['title'].'"?') ?> -- Under localhost/categories/view/1 it displays the table like this: | 1 | Test Category | ... error msg ... | View | Edit | Delete | Doesn't display the Actual Note title though. Did I do something wrong? This is the only thing that shows also. I have more then one note entry for that category. Thanks Again Nate! - J On Dec 15, 9:03 am, "nate" <[EMAIL PROTECTED]> wrote: > > should be > > > Then take the ['Note'] part out of the subsequent array references. A > helpful thing to do when coding your views is to put ?> at the bottom of your view, so you can read the structure of the > array as you are designing. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
redirect valid users to proper view?
I'm using latest cake build, php 4, and the rdSimpleAuth component to protect different views based on simple groups. I have app installed in a subdirectory of web site, such as /callcenter Problem is, I want a valid user to be forwarded to the index view of certain models, depending on group. After someone logs in, it works great, but if the somehow come back to /callcenter, it just shows my home.thtml page. How do I make it redirect them to the proper view if they return to root of my application? I'm trying to figure out if I should modify webroot/index.php, bootstrap.php, or what. Thanks, Brian --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
Já que tá todo mundo falando uma mistura de línguas, eu acho que vou começar a falar em português pra deixar a coisa mais engraçada, que tal? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
ok je m'en occupe! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
Oui il est cassé, et il faudrait mieux en recreer un (Cakephp-fr par ex) Je crois que les nouveaux membres doivent attendre la validation, mais le fondateur du groupe a pas l'air d'etre là olivvv bruno wrote: > Please do not bother reading if you do not speak frog. > > Bonjour, > j'essaye d'envoyer des questions sur Cakephp-fra mais elles ne sembles > pas arriver sur le groupe. > Comme l'activité du groupe semble faible est-il mis au placard? > faut-il en recreer un? est-ce moi qui ais mal configuré qqc? > > Merci! > > Bruno > PS: je suis entrain de me lancer dans un projet avec cakephp j'aurais > eu certainement a poster souvent ;) > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
nate a écrit : > Vive la France! Nate, actullaly that's all the french you need to be able to post into the french group ;-) > Let me be the first to say 'let them eat Cake!' ;-) Yes! you know we like our food... :-D --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: French speaking bakers only - Cakephp-fra down?
Vive la France! Bruno, I have no idea what you said, but the fact that there's a CakePHP group for French users is freaking awesome. Let me be the first to say 'let them eat Cake!' ;-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to make findAll() return object?
As far as how the objects are mapped, no, you can't do that stuff quite yet. (Well, techincally you could. Set::map takes a class name as an optional second parameter, so you could write a custom model class that adds the methods you wanted, and map the data to it.) But for right now, it just maps the array to a generic object that acts as a dumb data store. Object-based models are, however, something we plan to do in the future (most likely Cake 2.0). The reasons we chose to stick with an array-based design were that PHP has very strong support for working with arrays, and PHP4 compatibility is a key feature. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
should be Then take the ['Note'] part out of the subsequent array references. A helpful thing to do when coding your views is to put at the bottom of your view, so you can read the structure of the array as you are designing. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
French speaking bakers only - Cakephp-fra down?
Please do not bother reading if you do not speak frog. Bonjour, j'essaye d'envoyer des questions sur Cakephp-fra mais elles ne sembles pas arriver sur le groupe. Comme l'activité du groupe semble faible est-il mis au placard? faut-il en recreer un? est-ce moi qui ais mal configuré qqc? Merci! Bruno PS: je suis entrain de me lancer dans un projet avec cakephp j'aurais eu certainement a poster souvent ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to make findAll() return object?
> Cake 1.2 has not been officially released yet, but it has a core class > called Set, which allows you to map query results onto an object. The > syntax for that is: > > $this->set('posts', Set::map($this->Post->findAll())); This is interesting - does it mean we will be able to do things like : $post = Set::map($this->Post->findAll('author = "spammer"')); while($post->fetch()) { $post->hide(); } ? Or things like : $author = Set::map($this->Author->find('name = "spammer"')); $post = $author->getPosts(); while ($post->fetch()) { $post->hide(); } ? Anselm -- PS. Hi everyone :) I'm currently evaluating CakePhp. I need a Php framework, and having had a look around I found that, on top of having readable code and a good architechture, CakePhp had the best comunity infrastructure - which is a very important point. As I've been looking more in-depth today, the one thing I've been wondering about is the lack of object models (ie. doing the kind of things I mentioned above). However I read somewhere that this feature had been delayed to make sure that the 1. release would be a very stable release. Knowing that the developers favor stability over features (but that the feature will be there some point in the future) is maybe more important that having the feature now, so that is not a bad point. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: updating a div with ajax
I've done that, this is my onchange code onchange=\"new Ajax.Updater('rate_groups_div', 'rate_groups/getRateGroups/' + this.value, {evalScripts:true});\" on top of the re-created element i set up this variables, which works fine encode($results); ?> and the code that should be recreated is the following var rate_groups = =$rate_groups?>; var rg_ids = new Array(); oldRG_row = oldRT_row = oldEdit = 'undefined'; totalrgcount = =count($results)?>; however, this code is not recreated, Thanks for your help. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Errors in the View
Thanks for the reply nate! hmm, I just tried those, changed it in BOTH controllers and it didn't work. I get the same error. Do I have to change something in the View when using that code? - J On Dec 14, 9:27 pm, "nate" <[EMAIL PROTECTED]> wrote: > The problem is here: > > function view($id) > { > $this->set('data', $this->Category->read()); > } > > You aren't passing the $id to read. The line should read either: > $this->set('data', $this->Category->read(null, $id)); > or, my personal favorite: > $this->set('data', $this->Category->findById($id)); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: updating a div with ajax
On Dec 15, 2006, at 8:52 AM, luis_y27 wrote: > > This works perfectly thanks, however for some reason none of my code > within javascript tags is render with this call. Is there a reason > for > that? Thanks in advance. Make sure the evalScripts option is set to true for any of your calls. -- John --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: updating a div with ajax
This works perfectly thanks, however for some reason none of my code within javascript tags is render with this call. Is there a reason for that? Thanks in advance. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: php acl.php initdb failed
This is a known bug that has been fixed in the trunk. Either get the cake build from the trunk or fix it manually: in cake\scripts\acl.php line 93 change: uses ('object', 'neat_array', 'session', 'security', 'inflector', 'model'.DS.'connection_manager', to uses ('object', 'configure', 'neat_array', 'session', 'security', 'inflector', 'model'.DS.'connection_manager', On Dec 15, 2:13 am, "wong" <[EMAIL PROTECTED]> wrote: > Hi, > I am a cakephp newbie. > The latest cakephp, windows xp, > When I run php acl.php initdb, the system response is: > > Fatal error: Class 'Configure' not found in > C:\apache\Apache2\htdocs\cake\cake\libs\model\datasources\dbo_source.php > on line 84 > > Can you help me out? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help! finaAll Query churns out more records than i want
Go into app/config/core.php, and turn DEBUG up to 2, so you can see the actual SQL that's being generated. The next thing after checking the generated SQL, is to take it and run it inside an SQL client application, like CocoaMySQL, and see if the results you get are the same. If they are, then it's a problem in your database. Also, FYI, you can rewrite that query a little cleaner as: $this->User->findAll(array('User.active' => 1, 'User.id' => array(3,7,146,18,14)), null, "lastlogin DESC",null,null,0); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: updating a div with ajax
If you need an action to switch to rendering an element, just put something like this in the method: if ($this->RequestHandler->isAjax()) { $this->render("../elements/"); } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: How to make findAll() return object?
Cake 1.2 has not been officially released yet, but it has a core class called Set, which allows you to map query results onto an object. The syntax for that is: $this->set('posts', Set::map($this->Post->findAll())); --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Help with a moderately complex query
After handing out so much help (some good, some bad) I need some help getting a query to work with the models. Currently, I have the following two queries using the model: $start_results = $this->Stat->findAll("Site.category = {$category} AND Stat.s_date = '{$start_date}'"); $finish_results = $this->Stat->findAll("Site.category = {$category} AND Stat.s_date = '{$finish_date}'"); Site as a hasMany relationship with Stat Stat has a belongsTo relationship with Site Now, what I need to do is change the query to do the following select min(members) as from stats where site_id = AND (s_date >= '' AND s_date <= ''); select max(members) from stats where site_id = AND (s_date >= '' AND s_date <= ''); I need to have model-derived results sets so that I don't have to change any following code: if (is_array($start_results) && is_array($finish_results)) { $report_date = "{$start_date} to {$finish_date}"; foreach ($start_results as $result) { $site_id = $result['Site']['id']; $site_name[$site_id] = $result['Site']['name']; $start_members[$site_id] = $result['Stat']['members']; $start_threads[$site_id] = $result['Stat']['threads']; $start_posts[$site_id] = $result['Stat']['posts']; } foreach ($finish_results as $result) { $site_id = $result['Site']['id']; $finish_members[$site_id] = $result['Stat']['members']; $finish_threads[$site_id] = $result['Stat']['threads']; $finish_posts[$site_id] = $result['Stat']['posts']; } // Figure out the distances in the range if (is_array($start_members)) { foreach ($start_members as $site_id => $data) { $members[$site_id] = $finish_members[$site_id] - $start_members[$site_id]; $threads[$site_id] = $finish_threads[$site_id] - $start_threads[$site_id]; $posts[$site_id] = $finish_posts[$site_id] - $start_posts[$site_id]; } } } Any help would be greatly appreciated. -- Chris Hartjes "The greatest inefficiencies come from solving problems you will never have." -- Rasmus Lerdorf @TheBallpark - http://www.littlehart.net/attheballpark @TheKeyboard - http://www.littlehart.net/atthekeyboard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: updating a div with ajax
I have a similar dilemma. I want to refresh a div section without the need for a separate view in every directory. There ought to be some way to refresh the element itself. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
HABTM - validation of required relations
Hello all, It's my first post here. I've been googling for many hours today to find any clues how to validate form with required selection/choosing related items and finally written some code by myself. I'm not really familiar with Cake yet and I don't know if I haven't affected some of "general rules of good practice". But I haven't found any other piece of code. So.. The situation is: We have Users. Each User can belong to many Groups. But I want to have one form with inputs for user data and checkboxes/multiselect for choosing groups. User CAN'T be save without choosen group. I have taken validation method (invalidateFields) form wiki (Improved Advance Validation with Parameters), additionaly I've add method: /* place this in app/app_model.php */ define('VALID_CHOSEN', 'isChosen'); function isChosen($params) { if (isset($this->data[$params['var']][$params['var']])) { return (is_array($this->data[$params['var']][$params['var']]) && count($this->data[$params['var']][$params['var']])); } } This invalidateFields method validates posted data. But if checbox is not checked there is no entry in data table! This is html issue and we can't do anything with that. So in user.php (user model) in beforeValidate() method add: if (!isset($this->data['Group'])) $this->data['Group'] = array('Group' => array()); It will work if your multi choise form item is named like 'Group/Group'. You can also add it in app_model.php, but I personally do some additional checks in this method and override it localy. You can also try to place hidden fields in form, but I haven't tried it and I don't know how it works. beforeValidate() method sould be called at begin of invalidFields() method in app_model.php - I do not know why it isn't called automaticaly. In user model you should add also similar validation rule: 'Group' => array ( 'chosen' => array ( 'method' => VALID_CHOSEN, 'message' => 'You have not chosen a group', ), ) This is a bit strange to place something that is not realy a field in validation rules, but it is the only way I've found. Than in the view: $this->renderElement('errorMessage', array('message' => $error->messageFor('User/Group'))); And that's all. I hope that I haven't forgot about anything. Any suggestions welcome ;-) Marta. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Dependent model, call delete model
Hi, I have a model Photalbums and a model Photo's. Photo's have a entry in the database, but also a imagefile on the filesystem. Photomodel has his own method delete, which deletes the database entry (parent::delete) as well as the imagefile. In photoalbums, the relationship is set to dependent=true. This works more or less: when I delete a photoalbum, the associated photos are deleted from the database. But what I would like is that the method delete from this model is being used, instead of just generating the mysql queries. Is the already possible, or would it otherwise be usefull to add this functionality? Tnxs in advance, 2000Man --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
RE: How to make findAll() return object?
I may be out of line here, but why would you want this if Cake already lets you access it via indexed arrays? Anyway one thing I can think of is add the following method to your AppController: function toObject($array) { $result =& new stdClass; foreach($array as $index => $value) { if (!is_numeric($index) && is_array($value)) { $result->$index = $this->toObject($value); } else if (!is_numeric($index)) { $result->$index = $value; } } return $result; } And then on your controller change the code to: function listof() { $records = $this->Post->findAll(); if ($records !== false) { foreach($records as $index => $record) { $records[$index] = $this->toObject($record['Post']); } } $this->set('posts', $records); } I haven't tested this, so try it out. -MI --- Remember, smart coders answer ten questions for every question they ask. So be smart, be cool, and share your knowledge. BAKE ON! -Mensaje original- De: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] En nombre de Ananda Putra Enviado el: Viernes, 15 de Diciembre de 2006 06:25 a.m. Para: cake-php@googlegroups.com Asunto: How to make findAll() return object? How to make findAll() return object? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
php acl.php initdb failed
Hi, I am a cakephp newbie. The latest cakephp, windows xp, When I run php acl.php initdb, the system response is: Fatal error: Class 'Configure' not found in C:\apache\Apache2\htdocs\cake\cake\libs\model\datasources\dbo_source.php on line 84 Can you help me out? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to make findAll() return object?
Hi All, How to make findAll() return object? I write this in my controller: function listof() { $this->set('posts', $this->Post->findAll()); } then I want my "listof" view like this: TitleBody title ?> body ?> -- Regards, Ananda Putra --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Help! finaAll Query churns out more records than i want
The following code: $listFriends = "3,7,146,18,14"; $this->User->findAll("User.active = 1 AND User.id IN ($listFriends)", null, "lastlogin DESC",null,null,0); ... should return just 5 records from the Users table. However, i get 7 records and for some reason a triplicate of 146. Can anyone shed some light on this? I'm using version 1.1.8.3544 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---