Re: getLastInsertId or something similar
where do I grab the lastInsertId()? in the event_controller? and then how do I pass it to the user view? provided you've correctly set up your model associations, which I think are: User hasMany Event Event belongsTo User From your Users controller you can do: $event_id = $this-User-Event-getLastInsertId(); hth jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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 CakePHP with XAMPP for Windows
I often use Firebug with Firefox to deconfuse path issues like this. With Firebug you can inspect the image path written to HTML and edit it (in the instance of the page) to see what it should be - as soon as it points to the image correctly an image thumbnail will pop up in the Firebug window. As in the other two responses, check the locations and the Apache settings. I think XAMPP is mod rewrite enabled by default, and I think it also installs with a phpinfo.php file so you can scan the Apache section of that to see if the module has loaded. I'm not sure that InnoDB is required, though. I don't often use it. On a side issue, I don't really see the need for a *AMP stack in Windows as it is a breeze to install the three components by hand and you will have more control and a much better idea of what is going on. I used XAMPP on a Mac until it irretrievably fell over and I had to complete the Mac two-thirds setup myself by installing MySQL. Two days later, I felt I had learned a lot more about the Mac and I now have control of the server. On Jan 19, 1:46 am, Sharmo pe...@ozhonours.com wrote: Hi, I use XAMPP for Windows as my localhost server. I have installed CakePHP. I have made my first application using CakePHP. When I try to view the application, none of the CSS or images appear to be showing. Could you please suggest what I need to do to make it start working properly. I am more than happy to post any information that you want to see in order for us to solve the problem. I have already tried the forum atwww.phpvideotitorials.comas well as the forum at XAMPP. Please help! Regards Peter --~--~-~--~~~---~--~~ 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: AuthComponent usage
Thanks for explaining. The reason I asked is that I have never developed anything that allows anonymous (un-authenticated) visitors to do anything much at all (except view public stuff). On Jan 18, 10:41 pm, Robert forpoc...@gmail.com wrote: Why do you like this approach? /Martin Thanks for comment. It is consistent and easy to manage - You manage anonymous access just like any other - You change roles: f.e. You wan't to add anonymous comments - few clicks and it is done. You won't to disallow anonymous access completly - take off all the roles, and so on. It can be done other ways but thats the way I am used to :) How would You do this in cake? Robert --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
About custom cache features
I submitted a ticket about adding tag feature to cache and it got deleted soon. https://trac.cakephp.org/ticket/5965 OK, somebody think it's bad idea to touch the great core of CakePHP. But how to add custom cache features in CakePHP besides modifying the core? It had been mentioned in this ticket: https://trac.cakephp.org/ticket/3981 How do you use cache in CakePHP? 1. Clear all the cache in afterSave() method? 2. Clear all the cache in afterSave() method when saving some models? 3. Never using the built in cache feature? I don't like to submit another ticket to be deleted without any reason. --- kiang --~--~-~--~~~---~--~~ 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: AuthComponent usage
If you want public comments or something, just have the user_id in the database = 0. --~--~-~--~~~---~--~~ 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 CakePHP with XAMPP for Windows
If you need help enabling mod_rewrite: http://www.milesj.me/blog/read/12/enabling-modrewrite-in-xampp-windows --~--~-~--~~~---~--~~ 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 paginators
Hi, I think this is what your after http://debuggable.com/posts/how-to-have-multiple-paginated-widgets-on-the-same-page-with-cakephp:48ad241e-b018-4532-a748-0ec74834cda3 On 18 Jan, 22:08, ml mlehmusko...@gmail.com wrote: This could be a common problem, but searching this group provided no discussions with any pagination related words. I assume there could be something wrong with the search since pagination is probably a very widely used feature. Anyway, I'm trying to add two or more AJAX paginators on a view. When adding two paginated models from a single controller, all the models share a paginator meaning they all jump when one of them gets clicked. I'm doing this in the controller: $teams = $this-paginate('Team'); $users = $this-paginate('User'); debug($teams); $this-set(compact( 'teams', 'users')); After this, paginators can be added on the view for both teams and users, but the $paginator-prev and $paginator-next affect both of the paginators simultaneously. If I get the paginated data with requestAction from a view or element, no paginator at all is created on the view. How can I create more than on pagination helpers on the view? --~--~-~--~~~---~--~~ 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: About custom cache features
Btw, it wasn't deleted, only the version and milestone metadata was deleted from the ticket. It is still an open ticket. Cheers, Adam On Jan 19, 6:26 pm, kiang kia...@gmail.com wrote: I submitted a ticket about adding tag feature to cache and it got deleted soon.https://trac.cakephp.org/ticket/5965 OK, somebody think it's bad idea to touch the great core of CakePHP. But how to add custom cache features in CakePHP besides modifying the core? It had been mentioned in this ticket:https://trac.cakephp.org/ticket/3981 How do you use cache in CakePHP? 1. Clear all the cache in afterSave() method? 2. Clear all the cache in afterSave() method when saving some models? 3. Never using the built in cache feature? I don't like to submit another ticket to be deleted without any reason. --- kiang --~--~-~--~~~---~--~~ 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: Counting Tags. What is the find() syntax?
@Webweave. That's the article I was struggling with. I'll drink a few more cups of coffee and have another look. I'll use your select field tip in the meantime. On Jan 18, 3:46 pm, Webweave webwe...@gmail.com wrote: Easiest way I've found is just to include a select field in the query like: $data = $this-find(all, array( fields=array( Tag.id, Tag.name, (select COUNT(Article.id) from articles Article where Article.tag_id = Tag.id and Article.published = 1) AS tag_count ))); Here's an example of using the finderQuery:http://groups.google.com/group/cake-php/msg/c10840be78a34df0 On Jan 17, 12:55 am, RichardAtHome richardath...@gmail.com wrote: Given the following Model relations: article -- HABTM (articles_tags) -- tag How do I fetch back a list of Tags with the count of associated Articles? I've tried (in the Tag Model): $data = $this-find(all, array( fields=array( Tag.id, Tag.name, COUNT(Article.id) AS tag_count ), conditions=array( Article.published = 1 ), group = Tag.id )); But that doesn't generate the HABTM join in the SQL: SQL Error: 1054: Unknown column 'Article.id' in 'field list' SELECT `Tag`.`id`, `Tag`.`name`, COUNT(`Article`.`id`) AS tag_count FROM `tags` AS `Tag` WHERE `Article`.`published` = 1 GROUP BY `Tag`.`id` 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: Security Notice for 1.2.0.7962, Using AuthComponent without SecurityComponent
Is there a link to the details of the security concern? I know it's fixed now but I'm interested if I should always use the Security Component and what the implication is if I don't. Tried googling and looking in Trac but I can't seem to find out what the problem was. On Jan 16, 10:14 pm, Gwoo gwoo.cake...@gmail.com wrote: After the release of 1.2 Final, we received a lot of attention. Some of this came in the form of a security concern. The issue could affect sites relying on the AuthComponent for user authentication, without the use of the SecurityComponent. Essentially, an attacker may be able to obtain credentials as the first user of the system. If you are interested in testing your site, you can use the SQL Inject Me plugin for Firefox[1] Along with several other bugs, this issue was fixed in the recently released CakePHP 1.2.1.8004 Stable. We highly recommend that users upgrade to this release. A big thank you for all those who report these issues to us and allow us to fix them. Bake on, CakePHP team [1]https://addons.mozilla.org/en-US/firefox/addon/7597 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
problem with the API?
Is it me or is the API malfunctioning? If I search for 'find' it only comes back with Folder::find as a discrete method and a lot of other indirect matches. --~--~-~--~~~---~--~~ 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: CakePHP for commercial use
Oracle Apex is a very different type of solution from CakePHP. It seems that Apex is a web interface for building applications, while CakePHP is a programming framework. One requires no programming the other requires much more. If you are comparing these two solutions, I think you need to consider what your needs are as the two products you are comparing are not really comparable products. At least not in my opinion. -Mark On Jan 18, 11:40 am, reidster reidmckin...@gmail.com wrote: I was prototyping with Oracle Apex as an alternative. http://apex.oracle.com/i/index.html On Jan 18, 2:20 am, keymaster ad...@optionosophy.com wrote: before I abandon this effort in favor of commercial software... What commercial software? As far as I know, in the php world at least, there are no commerical frameworks which come close to cake's features and tested reliability. --~--~-~--~~~---~--~~ 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: Testing a controller method
You don't test private methods. You test your public interface, and by testing your public interface your implementation is also tested. As far as testing controllers I wrote a somewhat lenghty post on it http://mark-story.com/posts/view/testing-cakephp-controllers-the-hard-way As for testing email component, I almost always do this with a Mock object so that I can avoid any potential emails being sent by running the test suite, and to allow for better unit separation. Using mocks is just a good practice to get into as well. -Mark On Jan 18, 8:28 am, Fran Iglesias fran...@buabua.com wrote: Hi, I'm trying to write a test case for a private method in a controller. This controller uses the Email component. The method purpose is to send notifications via email to users. http://code.assembla.com/milhojas/subversion/nodes/dev/app/controller... I want to test if the message contains all data in the proper format. The test case, tries to send the email in debug delivery mode and compares the expected message to the Message.Email.messsage session variable. http://code.assembla.com/milhojas/subversion/nodes/dev/app/tests/case... The problem is that the Email component fails when trying to set a flash message (EmailComponent line 767) beacause Email-Session component is not an object. This only happens in the test context. So, my question is: what preparations have I to do in order to run this test? Thank you. -- Fran Iglesias fran...@buabua.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 -~--~~~~--~~--~--~---
containable and (left/inner) JOINS
i was wondering why the containable beh. as well as many other queries are done in that very complicated way of - getting the results of the first table - use these ids for the result of the other tables with IN(x,y,z,...) instead of just using LEFT JOIN? it really gave me headache yesterday trying to use containable on users - HAS MANY - phone_numbers - HAS MANY -numbers besides the fact that i did not get the inner join to work here, my actual problem is the following: either way (from users down to numbers, or the other way around), it resulted in over 1200 queries (!!!) crashing my apache and database or resulting in an execution timeout error. well, there are around 2000 entries - but after setting up a manual query like this: Select User.id, User.first_name, User.middle_name, User.last_name, Number.prefix, Number.number FROM numbers AS `Number` INNER JOIN phone_numbers AS `PhoneNumber` ON (Number.id = PhoneNumber.number_id) INNER JOIN users AS `User` ON (User.id = PhoneNumber.user_id) i ended up in 1/1 of time needed for the cake'sh way, with the exact result i expected. is there a way to accomplish something similar using the behaviour? usually left joins always execute hundred times faster then the cakeish way described above (especially if the tables get fuller and fuller) the result with my custom query now was: Array ( [0] = Array ( [User] = Array ( [first_name] = test [last_name] = user ) [Number] = Array ( [prefix] = 123 [number] = 123456 ) ) ... ) and if several users shared the same number, or a user had several numbers they would (as an inner join would do) result in seperate entries thx :) --~--~-~--~~~---~--~~ 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: Security Notice for 1.2.0.7962, Using AuthComponent without SecurityComponent
Is there a way to test this CVE without Firefox? I do not have the option of Firefox at work. Only IE7. On Jan 16, 4:14 pm, Gwoo gwoo.cake...@gmail.com wrote: After the release of 1.2 Final, we received a lot of attention. Some of this came in the form of a security concern. The issue could affect sites relying on the AuthComponent for user authentication, without the use of the SecurityComponent. Essentially, an attacker may be able to obtain credentials as the first user of the system. If you are interested in testing your site, you can use the SQL Inject Me plugin for Firefox[1] Along with several other bugs, this issue was fixed in the recently released CakePHP 1.2.1.8004 Stable. We highly recommend that users upgrade to this release. A big thank you for all those who report these issues to us and allow us to fix them. Bake on, CakePHP team [1]https://addons.mozilla.org/en-US/firefox/addon/7597 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Looking 4 good practice] HABTM - fields in jointable
Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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: CakePHP for commercial use
I've used Cake commercially for about two years now. Support may be an issue, but I have found this forum has answered most of my questions rapidly. The unanswered questions were usually about out-on-a-limb problems. Two things are certain, though: 1. Using Cake dramatically improved development times. Maybe not for the first project where there was necessarily a learning curve, but for subsequent projects where drop-in reuse of functionality enabled a project to be fleshed out very rapidly. With each subsequent project, this advantage increases and permits better focussing on project specific functionality. 2. I see Cake almost as a language, or maybe a dialect, in it's own right - albeit one that can be fully customised with PHP. Before anybody jumps on me, I know this isn't true, but I now view work as either written in PHP or written in Cake. It is certainly not a replacement for PHP expertise nor is it a way to learn PHP. To use it, you need to know PHP and if you do, any problems you may encounter will not be insurmountable. I looked at other solutions and templating systems, and to be honest, without trying them all it was difficult to assess which may be best. I just had to jump in feet first. But at the end of the day what difference is there? Why choose Joomla over Drupal? Ford over GM or one girl over another? They all do what they were designed to do. I don't regret my decision. A question for you - why PostgreSQL? --~--~-~--~~~---~--~~ 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: get method validation
It should be noted that the GET Request is not designed for this ;-) Hypertext Transfer Protocol (HTTP) Request methods GET Requests a representation of the specified resource. Note that GET should not be used for operations that cause side-effects, such as using it for taking actions in web applications. One reason for this is that GET may be used arbitrarily by robots or crawlers, which should not need to consider the side effects that a request should cause. http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol Or at least it should be seen as Best Pratice not to do so. On Jan 19, 1:53 am, Webweave webwe...@gmail.com wrote: Not sure I do, looks like you got a partial post. The validate 'numeric' for id, will validate the data for your id column as numeric. You don't even need that if the field is numeric as there wouldn't be allowed automatically. IF on the other hand you are asking how do I detect if a value was passed by GET or POST, that's an entirely different thing. POST data is passed in $this-data, GET data is passed in $this- passedArgs or $this-params['url']. Seehttp://book.cakephp.org/view/55/The-Parameters-Attribute-params On Jan 18, 11:43 am, Delirium tremens pedbe...@gmail.com wrote: Are you still not understanding the question? On 18 jan, 15:38, Delirium tremens pedbe...@gmail.com wrote: How come nobody knows??? On 18 jan, 13:30, Delirium tremens pedbe...@gmail.com wrote: How to validate an id passed not by post, but by get? I do not have to output an error message to hackers and crackers, do I? I tested using / ^[0-9]{1,10}$/ as rule, nothing as message and passing an a, but it did not output an error message. --~--~-~--~~~---~--~~ 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: baking cakephp on MAC OS
I used to use MAMP. It used a non-standard port for the DB. Check which port you're using and add it as shown in the database.php comments: * host = * the host you connect to the database. To add a socket or port number, use 'port' = # * --~--~-~--~~~---~--~~ 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: HABTM - fields in jointable
ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery'= '', 'deleteQuery'= '', 'insertQuery'= '' ) ); } ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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: HABTM - fields in jointable
uhm... i -partially- found the solution... if i load data from Customers_Controller the order_customer::afterFind doesn't work... On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote: ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) );} ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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: 'default' option of checkbox does not work :(
checked = 1 On Jan 19, 1:05 am, kizuki kurakur...@gmail.com wrote: After looking deeply at the source code in helper.php and form.php, I understood that the form helper is not designed to accept the 'default' value for checkboxes and radio buttons. (I also understood that my code change 2 above was not correct.) When I pass 'default' value to $form-input() method, it can only set the default value to the input tag, not for the value of the field. For the inputs which type is something like text, it sets the value of the field, but for those which type is checkbox and radio, the default value sets the value that is passed when it's checked, not the value of the field. I still think that the form helper should support default value for checkboxes and radio buttons, but it seems that it requires quite a few code changes. :( Looks like we have to write a code to switch the default checked state by ourselves for now. Kizuki --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Just a hint: CakePHP master slave
In post http://groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c an approach is described which does not work, unfortunately. For a viable solution, please have a look at http://bakery.cakephp.org/articles/view/load-balancing-and-mysql-master-and-slaves-2 though. -- Olav --~--~-~--~~~---~--~~ 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 do I limit the choice for time input to 30 minutes leaps?
Hi there, I've been giving the user the option to insert the time into a form like this: ?php echo $form-input('time');? Now the user has a choice of 60 minutes. I've been trying to limit the choice to 30 minutes leaps. So it should only be possible to choose 5:30, 6:00, 6:30 and so on. Is there any elegant way of doing this or do I have to write a huge html part listing every possible month, hour and minute? Thanks! Christine --~--~-~--~~~---~--~~ 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: core dot php
I have change a few character... but i still get the same message... On Jan 19, 1:05 pm, brian bally.z...@gmail.com wrote: Cake comes with a default value for Security.salt but will nag you to change it. The point is that it should be a value that only you know. Just change it to something else. You can even just change a single character, if you want. On Sun, Jan 18, 2009 at 7:04 PM, aku.haibar zero.bl...@gmail.com wrote: Hi all, I am new with cake php.. I'm having a small problem to setup cake php... Please change the value of 'Security.salt' in app/config/core.php to a salt value specific to your application [CORE\cake\libs\debugger.php, line 556] I dont understand the statement.. I have look at the value of security.salt at both file and it is the same.. can somebody help me --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
My Sql Query
Hello, Please tell me how we can hide the mysql query showing at bottom of the page, when we run a query. Its displays the no. of records founds etc. 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: Multiple paginators
That's right, you can set the page size etc. individually and the paginators render perfectly. However, the $paginator-next and $paginator-prev update both of the paginators, which is obviously not desired. On Jan 19, 6:51 am, Amit Badkas amitrb...@gmail.com wrote: You can provide model's name to paginator's options,http://book.cakephp.org/view/656/Methods 2009/1/19, ml mlehmusko...@gmail.com: This could be a common problem, but searching this group provided no discussions with any pagination related words. I assume there could be something wrong with the search since pagination is probably a very widely used feature. Anyway, I'm trying to add two or more AJAX paginators on a view. When adding two paginated models from a single controller, all the models share a paginator meaning they all jump when one of them gets clicked. I'm doing this in the controller: $teams = $this-paginate('Team'); $users = $this-paginate('User'); debug($teams); $this-set(compact( 'teams', 'users')); After this, paginators can be added on the view for both teams and users, but the $paginator-prev and $paginator-next affect both of the paginators simultaneously. If I get the paginated data with requestAction from a view or element, no paginator at all is created on the view. How can I create more than on pagination helpers on the view? -- Amit http://amitrb.wordpress.com/http://coppermine-gallery.net/http://cheesecake-photoblog.org/http://www.sanisoft.com/blog/author/amitbadkas --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Defining website structure with CakePHP
I've been reading about the MVC approach, and am considering moving to cakePHP as I think it would speed up my development in the long term. One thing I can't quite fathom - how does one structure their website with CakePHP? Is the normal approach to store the page hierarchy as a Tree? (http:// book.cakephp.org/view/91/Tree) The website is a mixture of dynamic/static content, and ideally I'd like to store the static content in the database so it's editable, but then I wasn't sure how to handle when a page wasn't static... would the tree have to store a link to a separate PHP page with the dynamic code in? Any examples of how others have gone about this? Thanks for any responses. --~--~-~--~~~---~--~~ 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: My Sql Query
In app/config/core.php set Configure::write('debug', 1); (or 0, which will suppress php errors as well) On Jan 19, 12:03 pm, somu somna...@gmail.com wrote: Hello, Please tell me how we can hide the mysql query showing at bottom of the page, when we run a query. Its displays the no. of records founds etc. 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: How do I limit the choice for time input to 30 minutes leaps?
It really depends on the design of your form. You could use an HTML select element as a time chooser and only specify the half hours as options. You could round up (or down) automatically. You could do it by validation (php or javascript). On Jan 19, 12:39 pm, ChristineA dins...@gmx.net wrote: Hi there, I've been giving the user the option to insert the time into a form like this: ?php echo $form-input('time');? Now the user has a choice of 60 minutes. I've been trying to limit the choice to 30 minutes leaps. So it should only be possible to choose 5:30, 6:00, 6:30 and so on. Is there any elegant way of doing this or do I have to write a huge html part listing every possible month, hour and minute? Thanks! Christine --~--~-~--~~~---~--~~ 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: Defining website structure with CakePHP
Take a look at wildflower cms, it's a cakephp based cms that does that. Stuart wrote: I've been reading about the MVC approach, and am considering moving to cakePHP as I think it would speed up my development in the long term. One thing I can't quite fathom - how does one structure their website with CakePHP? Is the normal approach to store the page hierarchy as a Tree? (http:// book.cakephp.org/view/91/Tree) The website is a mixture of dynamic/static content, and ideally I'd like to store the static content in the database so it's editable, but then I wasn't sure how to handle when a page wasn't static... would the tree have to store a link to a separate PHP page with the dynamic code in? Any examples of how others have gone about this? Thanks for any responses. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Relationships - HABTM
I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I set the recipe for the view var in the controller like so: $this-set('recipe', $this-Recipe-read()); I expect that when I view the recipe array in the view I should see a multi-array. Each Ingredient array should have a sub array that contains the ingredient, ingredient_type and measurement_type. But this is not the case. When I do a debug of the $this-viewVars in the view view I get the following output. As you can see the MeasurementType array is not under the Ingredient array. app\views\recipes\view.ctp (line 37) Array ( [Recipe] = Array ( [id] = 02 [recipe] = Cranberry Orange Bake [description] = A classic casserole with a festive flair. [instructions] = Preheat the oven to 400 degrees. Prepare stuffing mixture as directed on box substituting orange juice and water for broth. Stir the cranberries and pecans in with the stuffing mix. Combine the soup, Quorn and vegetables. Spoon into an 13x9 baking dish and top with the stuffing mixture. Bake for 30min or until cooked through. [servings] = 6 [recipe_type_id] = 06 [created] = 2009-01-16 10:35:19 [modified] = 2009-01-16 10:43:15 ) [Ingredient] = Array ( [0] = Array ( [id] = 31 [ingredient] = stuffing mix [ingredient_type_id] = 19 [description] = [created] = 2009-01-09 20:10:44 [modified] = 2009-01-09 20:13:14 [IngredientList] = Array ( [id] = 05 [recipe_id] = 02 [ingredient] = stuffing mix [fractional_amount] = [whole_amount] = 6 [measurement_type_id] = 01 [description] = [created] = 2009-01-16 10:35:19 [modified] = 2009-01-16 10:43:15 [ingredient_id] = 31 ) ) [1] = Array ( [id] = 32 [ingredient] = orange juice [ingredient_type_id] = 21 [description] = [created] = 2009-01-09 20:13:31 [modified] = 2009-01-09 20:13:31 [IngredientList] = Array ( [id] = 06 [recipe_id] = 02 [ingredient] = orange juice [fractional_amount] = [whole_amount] = 1 [measurement_type_id] = 02 [description] = [created] = 2009-01-16 10:35:19 [modified] = 2009-01-16 10:43:15 [ingredient_id] = 32 ) ) [2] = Array ( [id] = 13 [ingredient] = water [ingredient_type_id] = 12 [description] = [created] = 2009-01-04 15:48:26 [modified] = 2009-01-04 15:48:26 [IngredientList] = Array (
Re: HABTM - fields in jointable
What do you mean it doesn't work? Is it not firing, or are you getting an error ? On Jan 19, 7:05 am, Ernesto e.fanz...@gmail.com wrote: uhm... i -partially- found the solution... if i load data from Customers_Controller the order_customer::afterFind doesn't work... On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote: ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) );} ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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: Counting Tags. What is the find() syntax?
I couldn't see the point in a separate tags table, so I have a tags column on the table that requires it. To retrieve the tags and tag count, I do this: function getTagsWithCounts($conditions = array()) { // Return assoc_array(tags) for all records in database. Keyed on tagword, // value = tagcount $tagCounts = array(); $tagRows = $this-findAll($conditions, 'tags'); foreach ($tagRows as $row): $tags = explode(',',$row['Event']['tags']); foreach ($tags as $tag): $tag = trim($tag); if (array_key_exists($tag, $tagCounts)): $tagCounts[$tag]++; else: $tagCounts[$tag] = 1; endif; endforeach; endforeach; return $tagCounts; } It's simple and it is working on two commercial sites, soon to be four. --~--~-~--~~~---~--~~ 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: __mergeHasMany causing EXTREMELY slow data retrieval
On Jan 16, 4:57 pm, Miles J mileswjohn...@gmail.com wrote: Why do you even need to grab 2800? I need to load them to generate order statistics. Another reason would be for a CSV export. 2800 is very small. We're in the process of developing an app that could have hundreds of thousands of rows in multiple tables with a has many relationship. Also whats the speed like for a low amount of results. And what happens when you limit what fields are returned. I'm already limiting the fields to exactly what I need. I just simplified it for this post. I did some additional testing and it seems to loop (Order rows)^ (OrderLineItem rows) times! That's almost 8 million loops to process 2800 rows of data. It seems to loop through every Order row for every OrderLineItem row. Anyone know why it would do this? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Master / Slave Support
Hi all, we have discovered a way how to realize master/slave support with cake (also with multiple slaves). This old post is completely depricated: http://groups.google.com/group/cake-php/browse_thread/thread/58ea010f930fab6c Because Model::find() and Model::save() create the $db-handle lines before it calles the callbacks 'beforeFind' and 'beforeSave'. The way we realized is to overwrite the save() and updateAll() methodes and to set the default db-config in the AppModel::__construct (). Note: One thing remains: It's not possible to do a bindModel in the 'beforeSave' and 'afterSave' callbacks, because they get the wrong db- config... If you find a way to do it, please let us know! 1. Define your Database-Configs in app/config/database.php. You should have master and as much slaves you want to have: class DATABASE_CONFIG { var $master = array( driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'login', 'password' = 'password', 'database' = 'database', 'encoding' = 'utf8' ); // Config for Slave #1 var $slave1 = array( driver' = 'mysql', 'persistent' = false, 'host' = 'slave1', 'login' = 'login', 'password' = 'password', 'database' = 'database', 'encoding' = 'utf8' ); // Config for Slave #2 var $slave2 = array( driver' = 'mysql', 'persistent' = false, 'host' = 'slave2', 'login' = 'login', 'password' = 'password', 'database' = 'database', 'encoding' = 'utf8' ); ... } 2. Create/Alter app/models/app_model.php and create/alter the constructor '__construct' of it like the following: class AppModel extends Model { public function __construct($id = false, $table = null, $ds = null) { /** * USED FOR MASTER/SLAVE MECHANIC * **/ // If a datasource is set via params, use it and return if((is_array($id) isset($id['ds'])) || $ds) { parent::__construct($id, $table, $ds); return; } // Use a static variable, to only use one connection per page-call (otherwise we would get a new handle every time a Model is created) static $_useDbConfig; if(!isset($_useDbConfig)) { // Get all available database-configs $sources_list = ConnectionManager::enumConnectionObjects(); // Find the slaves we have $slaves = array(); foreach($sources_list as $name = $values) { // Slaves have to be named slave1, slave2, etc... if(preg_match('/^slave[0-9]+$/i', $name) == 1) { $slaves[] = $name; } } // Randomly use a slave $_useDbConfig = $slaves[rand(0, count($slaves) - 1)]; $this-_usedSlave = $_useDbConfig; } $this-useDbConfig = $_useDbConfig; parent::__construct($id, $table, $ds); } ... } This method uses a local static variable to save the db-config application-wide. It collects all configs from the database.php that start with slave# and selects a random one for it. This is now the default-config for the application that is used with every query done via the Model-class UNTIL we do the next step: 3. We now overwrite the Model::save() and Model::find() methods to use another database-config for write-queries! Note: We discovered, that it's not enough to just overwrite Model::save (), because Model::updateAll() doesn't use the callbacks, neither the Model::save() method. function save($data = null, $validate = true, $fieldList = array()) { // Remember the old config $oldDb = $this-useDbConfig; // Set the new config $this-setDataSource('master'); // Call the original Model::save() method $return = parent::save($data, $validate, $fieldList); // Reset the config/datasource $this-setDataSource($oldDb); return $return; } function updateAll($fields, $conditions = true) { $oldDb = $this-useDbConfig; $this-setDataSource('master'); $return = parent::updateAll($fields, $conditions); $this-setDataSource($oldDb); return $return; } Now you should have full master/slave support within your cake- application. The way it works: When your application is called, the AppModel will be called the first time and realizes, that the local $_useDbConfig variable is not set. So it randomly selects one of your slave-configs and sets this to the default used database-config (AppModel::useDbConfig). Every further instance of AppModel will recognize that the local $_useDbConfig variable already exists and will use the same config. Now every query you do will use this slave-config, EXCEPT all save's and updateAll's, because you've overwritten these methods to use your master-config. Hope this tutorial was helpful to you! Greetings, Andreas Hofmann! --~--~-~--~~~---~--~~ 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
Re: Relationships - HABTM
On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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 do I limit the choice for time input to 30 minutes leaps?
This will give you a MySQL compatible time for each half hour. for ($i=0; $i 24; $i++) { $hour = str_pad($i, 2, '0', STR_PAD_LEFT); $time_options[$hour.':00:00'] = $hour.'\'00'; $time_options[$hour.':30:00'] = $hour.'\'30'; } $form-input('time',array('type'='select','options'=$time_options)) On Jan 19, 4:33 pm, leo ponton@gmail.com wrote: It really depends on the design of your form. You could use an HTML select element as a time chooser and only specify the half hours as options. You could round up (or down) automatically. You could do it by validation (php or javascript). On Jan 19, 12:39 pm, ChristineA dins...@gmx.net wrote: Hi there, I've been giving the user the option to insert the time into a form like this: ?php echo $form-input('time');? Now the user has a choice of 60 minutes. I've been trying to limit the choice to 30 minutes leaps. So it should only be possible to choose 5:30, 6:00, 6:30 and so on. Is there any elegant way of doing this or do I have to write a huge html part listing every possible month, hour and minute? Thanks! Christine --~--~-~--~~~---~--~~ 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: Relationships - HABTM
Hi Brian thanks for writing back. The ingredient_lists table is where the ingredient, amount and ingredient level instructions are stored. I suppose it's really a join table for recipes, ingredients and measurement_types. So from your reply I should actually rename this to ingredients_recipes. And you are saying that the Ingredient model gets the HABTM instead of Recipe. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 12:26 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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: containable and (left/inner) JOINS
I think you misunderstand what the containable does. Your complaint is with model bindings in general, and not with this behavior. In any case, I'll leave you to expiriment and learn, but I wanted to tell you, to do an inner join in cake you use the config.. 'type'='INNER' in your binding definition. --~--~-~--~~~---~--~~ 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: Master / Slave Support
Thanks much. I didn't realize the old (and easy) method of doing this was deprecated. On Jan 19, 10:04 am, Andreas Hofmann andreas.hofman...@googlemail.com wrote: Hi all, we have discovered a way how to realize master/slave support with cake (also with multiple slaves). This old post is completely depricated:http://groups.google.com/group/cake-php/browse_thread/thread/58ea010f... Because Model::find() and Model::save() create the $db-handle lines before it calles the callbacks 'beforeFind' and 'beforeSave'. The way we realized is to overwrite the save() and updateAll() methodes and to set the default db-config in the AppModel::__construct (). Note: One thing remains: It's not possible to do a bindModel in the 'beforeSave' and 'afterSave' callbacks, because they get the wrong db- config... If you find a way to do it, please let us know! 1. Define your Database-Configs in app/config/database.php. You should have master and as much slaves you want to have: class DATABASE_CONFIG { var $master = array( driver' = 'mysql', 'persistent' = false, 'host' = 'localhost', 'login' = 'login', 'password' = 'password', 'database' = 'database', 'encoding' = 'utf8' ); // Config for Slave #1 var $slave1 = array( driver' = 'mysql', 'persistent' = false, 'host' = 'slave1', 'login' = 'login', 'password' = 'password', 'database' = 'database', 'encoding' = 'utf8' ); // Config for Slave #2 var $slave2 = array( driver' = 'mysql', 'persistent' = false, 'host' = 'slave2', 'login' = 'login', 'password' = 'password', 'database' = 'database', 'encoding' = 'utf8' ); ... } 2. Create/Alter app/models/app_model.php and create/alter the constructor '__construct' of it like the following: class AppModel extends Model { public function __construct($id = false, $table = null, $ds = null) { /** * USED FOR MASTER/SLAVE MECHANIC * **/ // If a datasource is set via params, use it and return if((is_array($id) isset($id['ds'])) || $ds) { parent::__construct($id, $table, $ds); return; } // Use a static variable, to only use one connection per page-call (otherwise we would get a new handle every time a Model is created) static $_useDbConfig; if(!isset($_useDbConfig)) { // Get all available database-configs $sources_list = ConnectionManager::enumConnectionObjects(); // Find the slaves we have $slaves = array(); foreach($sources_list as $name = $values) { // Slaves have to be named slave1, slave2, etc... if(preg_match('/^slave[0-9]+$/i', $name) == 1) { $slaves[] = $name; } } // Randomly use a slave $_useDbConfig = $slaves[rand(0, count($slaves) - 1)]; $this-_usedSlave = $_useDbConfig; } $this-useDbConfig = $_useDbConfig; parent::__construct($id, $table, $ds); } ... } This method uses a local static variable to save the db-config application-wide. It collects all configs from the database.php that start with slave# and selects a random one for it. This is now the default-config for the application that is used with every query done via the Model-class UNTIL we do the next step: 3. We now overwrite the Model::save() and Model::find() methods to use another database-config for write-queries! Note: We discovered, that it's not enough to just overwrite Model::save (), because Model::updateAll() doesn't use the callbacks, neither the Model::save() method. function save($data = null, $validate = true, $fieldList = array()) { // Remember the old config $oldDb = $this-useDbConfig; // Set the new config $this-setDataSource('master'); // Call the original Model::save() method $return = parent::save($data, $validate, $fieldList); // Reset the config/datasource $this-setDataSource($oldDb); return $return; } function updateAll($fields, $conditions = true) { $oldDb = $this-useDbConfig; $this-setDataSource('master'); $return = parent::updateAll($fields, $conditions); $this-setDataSource($oldDb); return $return; } Now you should have full master/slave support within your cake- application. The way it works: When your application is called, the AppModel will be called the first time and realizes, that the local $_useDbConfig variable is not set. So it randomly selects one of your slave-configs and sets this to the default used database-config (AppModel::useDbConfig). Every further instance of AppModel will recognize that the local $_useDbConfig variable already exists and will use the same config. Now every query you do will use this slave-config, EXCEPT all save's and updateAll's, because you've overwritten these methods to use your
Re: Security Notice for 1.2.0.7962, Using AuthComponent without SecurityComponent
@mlix changeset 7979 fixed the issue. Security prevents CSRF and ensures that form inputs properly match the values being submitted. @Pyrite im so sorry. I don't really have a way around your IE7 problem, short of storming the castle and demanding your work installs FF. --~--~-~--~~~---~--~~ 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: Relationships - HABTM
Both Recipe and Ingredient should be HABTM with each other. You can have many recipes which share ingredients. The join table for both would be: ingredients_recipes ingredient_id, recipe_id You could add an id primary key in there, also, as it might come in handy. It's not required, though. As for IngredientList, I'm not sure I've never thought much about doing this with Cake. I guess you could put the amount info, etc. in the ingredients_recipes join table but I'm not sure that'd be the best way. On Mon, Jan 19, 2009 at 12:50 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian thanks for writing back. The ingredient_lists table is where the ingredient, amount and ingredient level instructions are stored. I suppose it's really a join table for recipes, ingredients and measurement_types. So from your reply I should actually rename this to ingredients_recipes. And you are saying that the Ingredient model gets the HABTM instead of Recipe. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 12:26 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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: Rails 2 CakePHP
I don't think there are any pure guides for rails-cake, but it sounds like a good idea if someone wanted to take on the task. As for cheatsheets, we have one for 1.2, http://cakephp.org/downloads/Resources Comparing the blog tutorials might be helpful too, http://book.cakephp.org/view/219/Blog and --~--~-~--~~~---~--~~ 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: Rails 2 CakePHP
I don't think there are any pure guides for rails-cake, but it sounds like a good idea if someone wanted to take on the task. As for cheatsheets, we have one for 1.2, http://cakephp.org/downloads/Resources Comparing the blog tutorials might be helpful too, http://book.cakephp.org/view/219/Blog --~--~-~--~~~---~--~~ 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: Relationships - HABTM
Ok I get it. Thanks man I really appreciate your time. Steve -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 1:13 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM Both Recipe and Ingredient should be HABTM with each other. You can have many recipes which share ingredients. The join table for both would be: ingredients_recipes ingredient_id, recipe_id You could add an id primary key in there, also, as it might come in handy. It's not required, though. As for IngredientList, I'm not sure I've never thought much about doing this with Cake. I guess you could put the amount info, etc. in the ingredients_recipes join table but I'm not sure that'd be the best way. On Mon, Jan 19, 2009 at 12:50 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian thanks for writing back. The ingredient_lists table is where the ingredient, amount and ingredient level instructions are stored. I suppose it's really a join table for recipes, ingredients and measurement_types. So from your reply I should actually rename this to ingredients_recipes. And you are saying that the Ingredient model gets the HABTM instead of Recipe. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 12:26 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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: problem with the API?
Yeah, I agree. 'beforeFind' does not come up with any results of the method beforeFind. It's a bit strange, especially given that it's worked well for so long. --~--~-~--~~~---~--~~ 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: problem with the API?
Doxygen is not helping us anymore. We are working on the issues, but it's not pretty. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Multiple Check Box Styles
Does anyone know how to add a CSS style to the Checkbox? My controller code: $programs = $this-Software-Program-find('list', array('fields' = 'program', 'order' = 'program ASC')); which works as I want. But in the view: echo $form-input('Program',array('multiple'='checkbox')); it just outputs: checkbox {name of program} checkbox {name of program} checkbox {name of program} so on i would like to organize it so it looks more like a table using CSS checkbox {name of program} checkbox {name of program} checkbox {name of program} --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Route a /pages url to a controller
I am having trouble writing a route to direct an old /pages url to a newer controller url. The old pages url looks like this.. www.url.com/pages/tech_tips The url I want to route this to looks like this.. www.url.com/techtips I have tried different ways of writing the route and one of my attempts is.. $Route-connect('/pages/tech_tips', array('controller' = 'techtips', 'action' = 'display', 'index')); $Route-connect('/pages/*', array('controller' = 'pages', 'action' = 'display')); Not sure what I am doing wrong here. Do I need to alter the pages controller directly to get this to work? I am using CakePHP 1.1. Thanks! Brian --~--~-~--~~~---~--~~ 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 do I limit the choice for time input to 30 minutes leaps?
Christine, You might try this (I haven't tried it as I don't have time,but a quick look at the API found the attribute ' minuteInterval'): echo $form-input('date', array( 'minuteInterval' = 30)); Also look at the API http://api.cakephp.org/class_form_helper.html#363d9dcc25f7cd0624d3dc8f4254df34 and specifically http://api.cakephp.org/form_8php-source.html#l01530 and the relevant section in the book: http://book.cakephp.org/view/189/Automagic-Form-Elements Which, as usual, falls tantalisingly short of the nugget you need (sorry guys, I know you're doing a great job with the manual.) I've just tested it and it does work! On Jan 19, 12:39 pm, ChristineA dins...@gmx.net wrote: Hi there, I've been giving the user the option to insert the time into a form like this: ?php echo $form-input('time');? Now the user has a choice of 60 minutes. I've been trying to limit the choice to 30 minutes leaps. So it should only be possible to choose 5:30, 6:00, 6:30 and so on. Is there any elegant way of doing this or do I have to write a huge html part listing every possible month, hour and minute? Thanks! Christine --~--~-~--~~~---~--~~ 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: baking cakephp on MAC OS
Thanks for your solution...but still not working. I tried both above solution but not working. I am using xampp on MAC OS.. ERROR : Can't connect to local MySQL server through Socket '/var/ mysql/mysql.sock ? I also set envornment variable using echo 'export PATH=Application/xampp/xamppfiles/htdocs/clalumni/cake/ console/cake:$PATH' ~/.bash_profile echo 'export PATH=Application/xampp/xamppfiles/lib/php:$PATH' ~/.bash_profile but still not able to run cake bake? Please help me to run cake bake on MAC OS. Thanks On Jan 19, 8:22 pm, leo ponton@gmail.com wrote: I used to use MAMP. It used a non-standard port for the DB. Check which port you're using and add it as shown in the database.php comments: * host = * the host you connect to the database. To add a socket or port number, use 'port' = # * --~--~-~--~~~---~--~~ 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: baking cakephp on MAC OS
It has less to do with your path and more to do with your PHP is knocking on a door, and nobody is home. You need to find out where your mysql.sock is, and configure PHP to knock on that door instead. -Mark On Jan 19, 2:46 pm, bookme rarockthewo...@gmail.com wrote: Thanks for your solution...but still not working. I tried both above solution but not working. I am using xampp on MAC OS.. ERROR : Can't connect to local MySQL server through Socket '/var/ mysql/mysql.sock ? I also set envornment variable using echo 'export PATH=Application/xampp/xamppfiles/htdocs/clalumni/cake/ console/cake:$PATH' ~/.bash_profile echo 'export PATH=Application/xampp/xamppfiles/lib/php:$PATH' ~/.bash_profile but still not able to run cake bake? Please help me to run cake bake on MAC OS. Thanks On Jan 19, 8:22 pm, leo ponton@gmail.com wrote: I used to use MAMP. It used a non-standard port for the DB. Check which port you're using and add it as shown in the database.php comments: * host = * the host you connect to the database. To add a socket or port number, use 'port' = # * --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
App::import fail to load Component for imported controller
Writing an app where I was planing to move all email delivering in one controller. When I try to load this Utility controller in a function from another controller. App::import fail to load Email component in this controller Controller 1: code function send_message() { ... App::import('Controller', 'Main'); $main = new MainController; $main-simplemail($to, $subject, $body); } /code Utility controller: code class MainController extends AppController { var $name = 'Main'; var $components = array('Email'); var $uses = null; ... function simplemail($to, $subject, $body) { $mail_settings = Configure::read('Mail'); $this-Email-from= $mail_settings['from_name'] . ' ' . $mail_settings['from_mail'] . ''; $this-Email-to = $to; $this-Email-subject = $subject; debug($this-Email); //$this-Email-send($body); } /code --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
Thanks both of you for your input. All my mod_rewrite stuff is working properly. I was looking for a way to circumvent putting a Router::connect for each static page I have. Some of my sites have 100-150 static pages. I'm looking for a way to dynamically build the routes for all the pages. My script I wrote does work, I was just looking for input from others on ways to optimize my code a little, or to make sure I was using best practices. -Jesse On Jan 16, 5:38 pm, brian bally.z...@gmail.com wrote: In addition to clarkphp's comment, if you have static files inside directories, ie. views/pages/about/foo.ctp Router::connect('/about', array('controller' = 'pages', 'action' = 'display', 'about/index')); Router::connect('/about/*', array('controller' = 'pages', 'action' = 'display', 'about')); On Fri, Jan 16, 2009 at 4:01 PM, clarkphp clark.evere...@gmail.com wrote: Jesse, Are you wanting to access static pages without seeing the word pages in the URL? You could edit app/config/routes.php to have lines like this in it: Router::connect('/about', array('controller' = 'pages', 'action' = 'display', 'about')); Router::connect('/join', array('controller' = 'pages', 'action' = 'display', 'join')); Then if someone accesses your site withhttp://yoursite/aboutthey see the page at app/views/pages/about.php An access usinghttp://yoursite/joinwould display the join page at app/views/pages/join.php Are you using mod_rewrite in Apache? Or am I completely missing your intentions? - Clark On Jan 16, 10:19 am, Jesse jesseainsk...@gmail.com wrote: I know this comes up a lot. I've always fixed this before (1.1) with a core hack. I thought that as I moved my sites to 1.2 now I would come up with a little better solution. I'm not sure if this is the best solution but it works for me. I want others thoughts and opinions for this solution. THE BASICS: Use a class within the routes config to pull all files from the view/ pages directory. Loop through this to account for directories and such. Store these in array (do a little hygiene). Then, loop through this array and create a custom route for each page. It works for me, but I am still thinking there is a better way of integrating this into cake. I'll provide the code I'm using on my dev box below. Any suggestions are welcome /Component that does all the work... (should this not be a component?) ?php class PagesRoutesConfigComponent extends Object { var $default_dir; var $pages; var $dirs; var $deleted_dirs; function __construct(){ $this-default_dir = '/users/jesseainskeep/sites/inskeep- photography/app/views/pages/'; $this-pages = array(); $this-dirs = array(); $this-deleted_dirs = array(); //run through default directory $this-getPagesFromDir($this-default_dir); //funny way or writing this... this populates the pages array and jumps through each directory it sees $exit = true; while ($exit){ //run through array... foreach ($this-dirs as $key=$value){ $value = $value . /; $this-getPagesFromDir($value); $this-deleted_dirs[] = $value; unset($this-dirs[$key]); } if (empty($this-dirs)){ $exit = false; } } //kill the full path attached to each page foreach ($this-pages as $key=$value){ $this-pages[$key] = str_replace($this-default_dir, '', $value); } } function getPagesFromDir($sentDir){ $search = array('.ctp', '.thtml'); $replace = ''; if (is_dir($sentDir)) { if ($dh = opendir($sentDir)) { while (($file = readdir($dh)) !== false) { if (is_file($sentDir . $file)){ $file = str_replace($search, $replace, $file); $this-pages[] = $sentDir . $file; }elseif(is_dir($sentDir . $file) $file != . $file != .. ){ $this-dirs[] = $sentDir . $file; } } closedir($dh); }else{ echo Cannot open sent 'dir'!; } }else{ echo Sent 'dir' not available!; } } function printAll(){ echo h1Pages/h1; print_r($this-pages); echo br /br /; echo h1Directories/h1; print_r($this-dirs); echo br /br /; echo h1Deleted Directories/h1; print_r($this-deleted_dirs); echo br /br /; } } ? Code in routes file... //read all files in pages directory and create custom route for each one include_once('/users/jesseainskeep/sites/inskeep-photography/app/
Re: baking cakephp on MAC OS
If you're using XAMPP, I don't think it's a php/mysql config problem. that is precisely the problem these *AMP stacks are designed to avoid. However, you might want to try the following. Incidentally, that should be Applications PLURAL in your path. Open a terminal, and type: ps -af | grep mysql.sock [enter] The result on my machine is: sh-3.2# ps -ef | grep mysql.sock 74 2405 2379 0 0:15.88 ?? 1:57.74 /usr/ local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/ mysql/data --user=mysql --pid-file=/usr/local/mysql/data/ Leopard.local.pid --port=3306 --socket=/tmp/mysql.sock 0 4814 4805 0 0:00.01 ttys0000:00.01 grep mysql.sock sh-3.2# see the last bit? port=3306 socket=/tmp/mysql.sock that path (/tmp/mysql.sock) is the path to MY socket (and the port is the port!) yours will be different because mine is not an *AMP stack. Now, in your htdocs directory create phpinfo.php with ?php phpinfo() ? as the sole content. Make sure there is no new line after the ? View the file in Safari and halfway down the first screen is the path to the loaded configuration file. This is the one you need to edit to configure php. Continue down the page - you'll need to scroll about halfway down and see if there is a mysql section. If there is, I don't think you have a problem with php.ini. If there isn't, mysql isn't talking to PHP and you'll need to find and edit the appropriate part of the ini file. If I remember correctly, XAMPP already has a phpinfo link. I don't pretend that this is a solution, but if you post the results here, at least we'll have something to work with. Good luck. On Jan 19, 8:46 pm, bookme rarockthewo...@gmail.com wrote: Thanks for your solution...but still not working. I tried both above solution but not working. I am using xampp on MAC OS.. ERROR : Can't connect to local MySQL server through Socket '/var/ mysql/mysql.sock ? I also set envornment variable using echo 'export PATH=Application/xampp/xamppfiles/htdocs/clalumni/cake/ console/cake:$PATH' ~/.bash_profile echo 'export PATH=Application/xampp/xamppfiles/lib/php:$PATH' ~/.bash_profile but still not able to run cake bake? Please help me to run cake bake on MAC OS. Thanks On Jan 19, 8:22 pm, leo ponton@gmail.com wrote: I used to use MAMP. It used a non-standard port for the DB. Check which port you're using and add it as shown in the database.php comments: * host = * the host you connect to the database. To add a socket or port number, use 'port' = # * --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
On Mon, Jan 19, 2009 at 6:09 PM, Jesse jesseainsk...@gmail.com wrote: Thanks both of you for your input. All my mod_rewrite stuff is working properly. I was looking for a way to circumvent putting a Router::connect for each static page I have. Some of my sites have 100-150 static pages. I'm looking for a way to dynamically build the routes for all the pages. My script I wrote does work, I was just looking for input from others on ways to optimize my code a little, or to make sure I was using best practices. I think what would be nice is a way to set a default route so that if all standard routing fails, go off into a default route which would check if the requested page exists in app/views/pages in which case it would call the pages controller. If it doesn't exist, it could go on with the standard page not found procedure. Has anyone done this before or has a better solution in mind? - Gonzalo --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
Are your static pages html or PHP? Either way, why can't you just put them in webroot? They only need to be inside the cake structure if they're cake files. Jesse wrote: I know this comes up a lot. I've always fixed this before (1.1) with a core hack. I thought that as I moved my sites to 1.2 now I would come up with a little better solution. I'm not sure if this is the best solution but it works for me. I want others thoughts and opinions for this solution. THE BASICS: Use a class within the routes config to pull all files from the view/ pages directory. Loop through this to account for directories and such. Store these in array (do a little hygiene). Then, loop through this array and create a custom route for each page. It works for me, but I am still thinking there is a better way of integrating this into cake. I'll provide the code I'm using on my dev box below. Any suggestions are welcome /Component that does all the work... (should this not be a component?) ?php class PagesRoutesConfigComponent extends Object { var $default_dir; var $pages; var $dirs; var $deleted_dirs; function __construct(){ $this-default_dir = '/users/jesseainskeep/sites/inskeep- photography/app/views/pages/'; $this-pages = array(); $this-dirs = array(); $this-deleted_dirs = array(); //run through default directory $this-getPagesFromDir($this-default_dir); //funny way or writing this... this populates the pages array and jumps through each directory it sees $exit = true; while ($exit){ //run through array... foreach ($this-dirs as $key=$value){ $value = $value . /; $this-getPagesFromDir($value); $this-deleted_dirs[] = $value; unset($this-dirs[$key]); } if (empty($this-dirs)){ $exit = false; } } //kill the full path attached to each page foreach ($this-pages as $key=$value){ $this-pages[$key] = str_replace($this-default_dir, '', $value); } } function getPagesFromDir($sentDir){ $search = array('.ctp', '.thtml'); $replace = ''; if (is_dir($sentDir)) { if ($dh = opendir($sentDir)) { while (($file = readdir($dh)) !== false) { if (is_file($sentDir . $file)){ $file = str_replace($search, $replace, $file); $this-pages[] = $sentDir . $file; }elseif(is_dir($sentDir . $file) $file != . $file != .. ){ $this-dirs[] = $sentDir . $file; } } closedir($dh); }else{ echo Cannot open sent 'dir'!; } }else{ echo Sent 'dir' not available!; } } function printAll(){ echo h1Pages/h1; print_r($this-pages); echo br /br /; echo h1Directories/h1; print_r($this-dirs); echo br /br /; echo h1Deleted Directories/h1; print_r($this-deleted_dirs); echo br /br /; } } ? Code in routes file... //read all files in pages directory and create custom route for each one include_once('/users/jesseainskeep/sites/inskeep-photography/app/ controllers/components/pages_routes_config.php'); $worker = new PagesRoutesConfigComponent(); foreach ($worker-pages as $page){ Router::connect($page, array('controller' = 'pages', 'action' = 'display', ltrim($page, '/'))); } As I said, this is my first stab and there will for sure need to be revisions (dynamically pulling Cake path, auto loading component vs. doing include, ect). This works good on my machine, but I'm sure there are problems. Suggestions welcome! --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
On Mon, Jan 19, 2009 at 6:48 PM, leo ponton@gmail.com wrote: Are your static pages html or PHP? Either way, why can't you just put them in webroot? They only need to be inside the cake structure if they're cake files. That means I can't take advantage of the CakePHP helpers and such ... besides, if they go in webroot, that means the layout won't apply so I think they need to go through CakePHP in my case. - Gonzalo --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
hi Jesse, I was looking for a way to circumvent putting a Router::connect for each static page I have. Some of my sites have 100-150 static pages. I'm looking for a way to dynamically build the routes for all the pages. My script I wrote does work, I was just looking for input from others on ways to optimize my code a little, or to make sure I was using best practices. One other thing, as Router:: is a static class, you should be able to create the routes from within the component. Also, perhaps, although this is routing related, this should be done in bootstrap instead? hth, Jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: core dot php
I dont think thats possible. Just put any word or characters for the value and save it. --~--~-~--~~~---~--~~ 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: Anyone built a forum system yet?
Bump over weekend. --~--~-~--~~~---~--~~ 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: Anyone built a forum system yet?
I'd like to know if anyone has done this also. I want to build a forum into my current website but the sheer vastness of it is intimidating. --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
hi Jesse, I was looking for a way to circumvent putting a Router::connect for each static page I have. Some of my sites have 100-150 static pages. I'm looking for a way to dynamically build the routes for all the pages. My script I wrote does work, I was just looking for input from others on ways to optimize my code a little, or to make sure I was using best practices. I like the idea, certainly very handy. That coupled with Gonzalo's default route idea would make things really good. Some things I'd look at to make things more cakey 1. Use cake's Folder class to obtain the files 2. Use App::import('component', 'PagesRoutesConfig'); // off top of head, might be wrong! 3. What about making it work for dynamic pages as well? using ClassRegistry::init('Page') in your component to get items from the database 3a. If you do the above, you'll need to watch for duplicates hth Jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: Counting Tags. What is the find() syntax?
I couldn't see the point in a separate tags table What about 2 articles that share the same tags? You run the risk of tagging either with one or 1 (for example) or CakePHP, cakephp, Cakephp, cakePHP... There's an awful lot of processing happening in your foreach loop. What happens when you get 10,000 records? or 100,000? A relational database eats this kind of aggregation for breakfast :-) On Jan 19, 4:20 pm, leo ponton@gmail.com wrote: I couldn't see the point in a separate tags table, so I have a tags column on the table that requires it. To retrieve the tags and tag count, I do this: function getTagsWithCounts($conditions = array()) { // Return assoc_array(tags) for all records in database. Keyed on tagword, // value = tagcount $tagCounts = array(); $tagRows = $this-findAll($conditions, 'tags'); foreach ($tagRows as $row): $tags = explode(',',$row['Event']['tags']); foreach ($tags as $tag): $tag = trim($tag); if (array_key_exists($tag, $tagCounts)): $tagCounts[$tag]++; else: $tagCounts[$tag] = 1; endif; endforeach; endforeach; return $tagCounts; } It's simple and it is working on two commercial sites, soon to be four. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Issue with Securty component
Hi there, I found out that using debug($variable) in a view leads to missing Token Keys in the forms rendered in that view. Does someone knows why? Kind regards, Volka --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
Ahh..you didn't say that. Seems to me all you need to do is put the pages in ..er.. pages and make sure that the pages route is last in the routes.php file. That way everything that has a home will find it and the rest falls through to pages. No lookup for page names needed. You might even be able to do a Router::connect('/*',.. I've done something like this before, I just can't access the code. On Jan 19, 9:50 pm, Gonzalo Servat gser...@gmail.com wrote: On Mon, Jan 19, 2009 at 6:48 PM, leo ponton@gmail.com wrote: Are your static pages html or PHP? Either way, why can't you just put them in webroot? They only need to be inside the cake structure if they're cake files. That means I can't take advantage of the CakePHP helpers and such ... besides, if they go in webroot, that means the layout won't apply so I think they need to go through CakePHP in my case. - Gonzalo --~--~-~--~~~---~--~~ 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: Anyone built a forum system yet?
Ive built my own forum from scratch. It works flawlessly, but the one thing I never understood is the read/unread of topics. Because storing that information in the database would be huge. --~--~-~--~~~---~--~~ 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: Anyone built a forum system yet?
That's pretty cool. Since you said you did it from scratch, I'm guessing you didn't use cake? Could you give me a link to your forum so I could check it out? Thanks On Jan 19, 4:28 pm, Miles J mileswjohn...@gmail.com wrote: Ive built my own forum from scratch. It works flawlessly, but the one thing I never understood is the read/unread of topics. Because storing that information in the database would be huge. --~--~-~--~~~---~--~~ 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: Relationships - HABTM
Hi Brian one more thing for clarification. My expectation is that if I define the relationships correctly and my DB table are keyed correctly when I call for a read all from the Recipe model I should all related information from all tables no matter how deep the relationship. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 1:13 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM Both Recipe and Ingredient should be HABTM with each other. You can have many recipes which share ingredients. The join table for both would be: ingredients_recipes ingredient_id, recipe_id You could add an id primary key in there, also, as it might come in handy. It's not required, though. As for IngredientList, I'm not sure I've never thought much about doing this with Cake. I guess you could put the amount info, etc. in the ingredients_recipes join table but I'm not sure that'd be the best way. On Mon, Jan 19, 2009 at 12:50 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian thanks for writing back. The ingredient_lists table is where the ingredient, amount and ingredient level instructions are stored. I suppose it's really a join table for recipes, ingredients and measurement_types. So from your reply I should actually rename this to ingredients_recipes. And you are saying that the Ingredient model gets the HABTM instead of Recipe. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 12:26 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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: Solution for static page with no pages in URL
On Mon, Jan 19, 2009 at 7:21 PM, leo ponton@gmail.com wrote: Ahh..you didn't say that. Seems to me all you need to do is put the pages in ..er.. pages and make sure that the pages route is last in the routes.php file. That way everything that has a home will find it and the rest falls through to pages. No lookup for page names needed. You might even be able to do a Router::connect('/*',.. This isn't quite what I need as it makes any request for /controller/action also go to the pages controller (which is great for static pages but not if you have some non-static pages in controllers). If you managed to do it, I'd love to see your solution. - Gonzalo --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
MVC Desing tips
Hi guys! I'm pretty new to Cake PHP and what I find really hard, being used to develop PHP without following any rule or schema, is to get used to the MVC design.model. In this moment I'm creating stuff without any particular purpose in mind, but just to get confident with the framework and to build something I''ll be able to reuse later What I have in mind is pretty simple. I want a site where different kind of contents can be published: news, pics, videos, etc. I think each of them can be displayed in a different section of the site and so easily implemented through a controller (NewsController, VideosController, etc.), its model and a set of views to access standard operations: browse, add, edit and delete contents. Now I want to add a feature shared among all this controllers to let user add comments to a conent. All comments will have the sane info (username, date, text, etc.) and should be displayed and managed in the same way regardless of the section where they're posted. It sounds simple but I have no idea on how to design it following MVC principles. Model I was thinking of having a unique table for all the comments and a set of associatives tables, one for each type of contents, to store association between a comment and a content item. Is not the best approach if we think about performance, so an alternative could be to have separate commments tables to speed up filtering. Anyway is not my first concern now. Controller I have two idea on how to implement the basic actions, but none of them looks right to me. The first is to have a comments controller class implementing the actions and then to create a set of subclasses, one for each type of contents, so I would have NewsCommentsController, VideosCommentsController, etc. In the subclasses I'd declare the right instance of the Model and call the superclass actions. The other idea is to have a component implementing the shared functionalities, but I've no idea if it's the right way to use a component and on how to do it. View I figure out I should have at least a view (or maybe an element?) to add a comment and one to show them, and that's all. A part from this what I can't understand well is how to put together all the pieces to obtain the final result. For instance having a main controller and its view, for example showing news, how can I add the action for posting/showing comments (that are in a different controller or component) and it's related view in the same page? U hope someone can give me some wise tips.And if someone is not clear, pleas ask me, I'm not a native english speaker and so I do lot of confusion some times. Thanks;) Andrea --~--~-~--~~~---~--~~ 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: Counting Tags. What is the find() syntax?
All the tags are lowercased. Sure you can have 1 or One but how does a separate table avoid that? What about spelling mistakes? How are you going to handle your tags? A mother of all drop down lists? Will you create christian name and surname tables in case there are two Johns? There are sensible limits to normalisation and in this instance I felt it was another table too far. If I make a blog entry a day, 1 will take me beyond my life expectancy.10 beyond that of my children's great grand children. A loop in a loop is naughty but we're talking about half a dozen iterations. You're talking about two table lookups. Sometimes purity of code and religious normalisation are just too much tub thumping. Get the job done. If it breaks fix it. On Jan 19, 10:11 pm, RichardAtHome richardath...@gmail.com wrote: I couldn't see the point in a separate tags table What about 2 articles that share the same tags? You run the risk of tagging either with one or 1 (for example) or CakePHP, cakephp, Cakephp, cakePHP... There's an awful lot of processing happening in your foreach loop. What happens when you get 10,000 records? or 100,000? A relational database eats this kind of aggregation for breakfast :-) On Jan 19, 4:20 pm, leo ponton@gmail.com wrote: I couldn't see the point in a separate tags table, so I have a tags column on the table that requires it. To retrieve the tags and tag count, I do this: function getTagsWithCounts($conditions = array()) { // Return assoc_array(tags) for all records in database. Keyed on tagword, // value = tagcount $tagCounts = array(); $tagRows = $this-findAll($conditions, 'tags'); foreach ($tagRows as $row): $tags = explode(',',$row['Event']['tags']); foreach ($tags as $tag): $tag = trim($tag); if (array_key_exists($tag, $tagCounts)): $tagCounts[$tag]++; else: $tagCounts[$tag] = 1; endif; endforeach; endforeach; return $tagCounts; } It's simple and it is working on two commercial sites, soon to be four. --~--~-~--~~~---~--~~ 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: Anyone built a forum system yet?
www.sc2armory.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: Issue with Securty component
Sorry, that was a canard. It has nothing to do with debug(). The reason was: I didn't had 'Security' in my app_controller, and when displaying the element loginbox.ctp on home, it didn't recognize 'Security' as i used it in my users_controller only.. On 19 Jan., 22:11, volka volker.b...@googlemail.com wrote: Hi there, I found out that using debug($variable) in a view leads to missing Token Keys in the forms rendered in that view. Does someone knows why? Kind regards, Volka --~--~-~--~~~---~--~~ 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: Anyone built a forum system yet?
Have you released / are you planning to release source for this? Cheers, Graham On Mon, 19 Jan 2009 13:43:05 -0800 (PST), Miles J mileswjohn...@gmail.com wrote: www.sc2armory.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: Anyone built a forum system yet?
Well its not built with Cake if thats what your asking. Im planning to port hte current (my custom code) over to Cake because it has more security, cache, etc. And no ill probably not release the code, its pretty basic. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
The Manual»Example Applications»Blog»Deleting Posts - a security issue
http://localhost/CakePHP/cakeBlog/posts/delete/1 1 can be anything What if a cracker visits http://localhost/CakePHP/cakeBlog/posts/delete/'all' or something like that? How are you protecting your site? What would an explanation look like in the manual about denying any argument like 'all' from being passed to a method like delete? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Cron Job Hostgator
I'm attempting to implement cron jobs into my website but I'm having a little trouble. I created the cron_dispatcher file I found at http://bakery.cakephp.org/articles/view/calling-controller-actions-from-cron-and-the-command-line I then entered the following in my hostgator cron job page under the command field: php cron_dispatcher.php /pages/cron But when the job runs and I am notified via email, it says 404 not found. I am guessing that what I am putting in the command field is incorrect. Any Ideas on what would be the proper solution? Thank you as always. --~--~-~--~~~---~--~~ 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: The Manual»Example Applications»Blog»Deleting Posts - a security issue
You could just do something like: function delete($id=null) { if(is_numeric($id)) { $this-Post-del($id); // etc. } } On Jan 19, 5:29 pm, Delirium tremens pedbe...@gmail.com wrote: http://localhost/CakePHP/cakeBlog/posts/delete/1 1 can be anything What if a cracker visitshttp://localhost/CakePHP/cakeBlog/posts/delete/'all' or something like that? How are you protecting your site? What would an explanation look like in the manual about denying any argument like 'all' from being passed to a method like delete? --~--~-~--~~~---~--~~ 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: The Manual»Example Applications»Blog»Deleting Posts - a security issue
On Jan 19, 11:29 pm, Delirium tremens pedbe...@gmail.com wrote: http://localhost/CakePHP/cakeBlog/posts/delete/1 1 can be anything What if a cracker visitshttp://localhost/CakePHP/cakeBlog/posts/delete/'all' if you accessed that url and deleted all of your posts - you've done something wrong it would generate .. where id = all - which would do nothing. If you mean more generally how to secure your actions - that's auth + not doing anything via GET requests (i.e. protecting yourself from CSRF). Simply by using the security component and requirePost for delete can achieve that, it would mean unless your code generated the form to the delete action it wouldn't do anything. 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 -~--~~~~--~~--~--~---
Saving Multiple Records
Hey everyone, So, I've googled everything in regards to adding multiple records in a single form and I have not had any beginners luck. My cakephp project consist of creating an online business survey for future clients who need a web site developed. The survey has three key tables related to my problem, - Responses - Clients - Questions The setup: Note: CakePHP v1.2.0.7962 and MySQL In my view, I am passed an array of questions from the Question model and I display them using a loop. Additionally, I am creating text areas which are assigned to the 'Response.response' field name from Response model. How do I go about saving the data so that each question ID, response, and the associated client ID are inserted into the Response table? //create survey form echo $form-create('Response',array('action'='add')) . \n; echo $form-input('Response.client_id',array('type'='hidden', 'value' = $client_id)); ? ul ? $question_number = 1; foreach ($Questions as $question): // '.$question['Question']['question_id'].'. ? li b?php echo $question_number++ . . . $question['Question'] ['question']; ?/b br / ? echo $form-textArea('Response.response', array('label'=$question['Question']['question_id'])); ? br / ? echo $form-input('Response.question_id', array ('type'='hidden','value'=$question['Question']['question_id'])); ? br / /li ? endforeach; echo $form-end('Continue'); ? /ul --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
access the name of the active model in the view
Short of performing surgery on the URI, how can I determine the model which has called the current view? I'd like to add it to my default layout so I can automate some tabs. Thanks. Frank --~--~-~--~~~---~--~~ 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: getLastInsertId or something similar
eeerrr, this is not working. I have this in the User model: var $hasMany = array ('Event'); this in the event model: var $belongsTo = array ( 'User' = array( 'className'= 'User', 'foreignKey'= 'creator_id', ) ); $this-User-Event-getLastInsertId() in the users controller returns nothing! what am I missing?? On Jan 19, 3:01 am, Jon Bennett jmbenn...@gmail.com wrote: where do I grab the lastInsertId()? in the event_controller? and then how do I pass it to the user view? provided you've correctly set up your model associations, which I think are: User hasMany Event Event belongsTo User From your Users controller you can do: $event_id = $this-User-Event-getLastInsertId(); hth jon -- jon bennett w:http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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: baking cakephp on MAC OS
Also since you are on macos check which php you are using. I bet you are using the stock Apple PHP which php Should give you the path to the PHP that is the cli default. -Mark On Jan 19, 3:36 pm, leo ponton@gmail.com wrote: If you're using XAMPP, I don't think it's a php/mysql config problem. that is precisely the problem these *AMP stacks are designed to avoid. However, you might want to try the following. Incidentally, that should be Applications PLURAL in your path. Open a terminal, and type: ps -af | grep mysql.sock [enter] The result on my machine is: sh-3.2# ps -ef | grep mysql.sock 74 2405 2379 0 0:15.88 ?? 1:57.74 /usr/ local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/ mysql/data --user=mysql --pid- file=/usr/local/mysql/data/ Leopard.local.pid --port=3306 --socket=/tmp/mysql.sock 0 4814 4805 0 0:00.01 ttys000 0:00.01 grep mysql.sock sh-3.2# see the last bit? port=3306 socket=/tmp/mysql.sock that path (/tmp/mysql.sock) is the path to MY socket (and the port is the port!) yours will be different because mine is not an *AMP stack. Now, in your htdocs directory create phpinfo.php with ?php phpinfo() ? as the sole content. Make sure there is no new line after the ? View the file in Safari and halfway down the first screen is the path to the loaded configuration file. This is the one you need to edit to configure php. Continue down the page - you'll need to scroll about halfway down and see if there is a mysql section. If there is, I don't think you have a problem with php.ini. If there isn't, mysql isn't talking to PHP and you'll need to find and edit the appropriate part of the ini file. If I remember correctly, XAMPP already has a phpinfo link. I don't pretend that this is a solution, but if you post the results here, at least we'll have something to work with. Good luck. On Jan 19, 8:46 pm, bookme rarockthewo...@gmail.com wrote: Thanks for your solution...but still not working. I tried both above solution but not working. I am using xampp on MAC OS.. ERROR : Can't connect to local MySQL server through Socket '/var/ mysql/mysql.sock ? I also set envornment variable using echo 'export PATH=Application/xampp/xamppfiles/htdocs/clalumni/cake/ console/cake:$PATH' ~/.bash_profile echo 'export PATH=Application/xampp/xamppfiles/lib/php:$PATH' ~/.bash_profile but still not able to run cake bake? Please help me to run cake bake on MAC OS. Thanks On Jan 19, 8:22 pm, leo ponton@gmail.com wrote: I used to use MAMP. It used a non-standard port for the DB. Check which port you're using and add it as shown in the database.php comments: * host = * the host you connect to the database. To add a socket or port number, use 'port' = # * --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Yet Another HABTM Save Question
Hey all - I see a lot of questions about this, but nothing I've found references the error I'm seeing so I thought I'd post here and see whether anyone else recognizes what I'm doing wrong. I have an Event model that habtm Attraction: class Event extends AppModel { public $name= 'Event'; public $belongsTo = 'Location'; public $hasAndBelongsToMany = 'Attraction'; ... } class Attraction extends AppModel { public $name = 'Attraction'; public $hasAndBelongsToMany = array ( 'Event' ); ... } In my EventsController, I have: $attractions = $this-Event-Attraction-find ( 'list' ); // the value is being set() later in the controller code And in my view: echo $form-input ( 'Attraction', // I've also tried Attraction.Attraction per the docs array ( 'type' = 'select', 'empty' = true ) ); When I try to save my Event ($this-Event-save ( $this-data ) ), I get this error: SQL Error: 1110: Column 'event_id' specified twice [CORE/cake/libs/ model/datasources/dbo_source.php, line 514] Query: INSERT INTO `attractions_events` (`event_id`,`attraction_id`,`event_id`) VALUES ('4975132e-b0fc-42ee- a13f-9e633b196446','495f9db0- b548-4ee2-94ff-4aebc0a80232','4975132e-7a60-498b-819f-9e633b196446') Anyone have any thoughts? I read and re-read the docs, plus a few habtm blog posts, but I'm not seeing whatever it is I'm doing wrong. I'd appreciate it if someone could point me in the right direction. Thanks. --~--~-~--~~~---~--~~ 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: About custom cache features
Sorry, I misunderstand the message. Thanks, Adam. --- kiang On 1月19日, 下午6時30分, Adam Royle a...@sleekgeek.com.au wrote: Btw, it wasn't deleted, only the version and milestone metadata was deleted from the ticket. It is still an open ticket. Cheers, Adam On Jan 19, 6:26 pm, kiang kia...@gmail.com wrote: I submitted a ticket about adding tag feature to cache and it got deleted soon.https://trac.cakephp.org/ticket/5965 OK, somebody think it's bad idea to touch the great core of CakePHP. But how to add custom cache features in CakePHP besides modifying the core? It had been mentioned in this ticket:https://trac.cakephp.org/ticket/3981 How do you use cache in CakePHP? 1. Clear all the cache in afterSave() method? 2. Clear all the cache in afterSave() method when saving some models? 3. Never using the built in cache feature? I don't like to submit another ticket to be deleted without any reason. --- kiang --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
mercado cakephp (era- Re: abnormal flash)
On Sun, Jan 18, 2009 at 1:03 PM, Delirium tremens pedbe...@gmail.com wrote: Existe mercado de trabalho para programador de CakePHP no Brasil??? Tenho que sair logo. Cara, essa é uma boa pergunta. Eu também sou muito entusiasmado com o Cake e gostaria muitíssimo de trabalhar profissionalmente com ele. Tem chance de trabalho frela internacional no cakephp.org/jobs, mas ainda não consegui nada. Se alguém tiver algo a contribuir, à vontade. PS: ... oi Marcelo, supresa! eu sou brasileiro também!!! hahaha Hehehe... Só para o pessoal entender, é que o Pedro fez uma pergunta na lista gringa e aí ficou dois brasileiros falando um com o outro em ingrês, hehehe. On 18 jan, 13:44, Marcelo Andrade mfandr...@gmail.com wrote: On Sun, Jan 18, 2009 at 12:37 PM, Delirium tremens pedbe...@gmail.com wrote: Flash is called like that because you see the message and seconds later you are redirected, right? Well, my flash does not redirect. Why??? Your debug level at config modifies the flash behaviour. Best regards. Atenciosamente. -- MARCELO DE F. ANDRADE (aka eleKtron) Belem, PA, Amazonia, Brazil Linux User #221105 [...@pará ~]# links http://pa.slackwarebrasil.org/ For Libby's backstory be told on Lost http://www.petitiononline.com/libby423/petition.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mercado cakephp (era- Re: abnormal flash)
mais um =) 2009/1/19 Marcelo Andrade mfandr...@gmail.com On Sun, Jan 18, 2009 at 1:03 PM, Delirium tremens pedbe...@gmail.com wrote: Existe mercado de trabalho para programador de CakePHP no Brasil??? Tenho que sair logo. Cara, essa é uma boa pergunta. Eu também sou muito entusiasmado com o Cake e gostaria muitíssimo de trabalhar profissionalmente com ele. Tem chance de trabalho frela internacional no cakephp.org/jobs, mas ainda não consegui nada. Se alguém tiver algo a contribuir, à vontade. PS: ... oi Marcelo, supresa! eu sou brasileiro também!!! hahaha Hehehe... Só para o pessoal entender, é que o Pedro fez uma pergunta na lista gringa e aí ficou dois brasileiros falando um com o outro em ingrês, hehehe. On 18 jan, 13:44, Marcelo Andrade mfandr...@gmail.com wrote: On Sun, Jan 18, 2009 at 12:37 PM, Delirium tremens pedbe...@gmail.com wrote: Flash is called like that because you see the message and seconds later you are redirected, right? Well, my flash does not redirect. Why??? Your debug level at config modifies the flash behaviour. Best regards. Atenciosamente. -- MARCELO DE F. ANDRADE (aka eleKtron) Belem, PA, Amazonia, Brazil Linux User #221105 [...@pará ~]# links http://pa.slackwarebrasil.org/ For Libby's backstory be told on Lost http://www.petitiononline.com/libby423/petition.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: mercado cakephp (era- Re: abnormal flash)
Ae galera tenho encontrado alguns freelas através desses dois sites: http://www.odesk.com/ http://www.elance.com/ Boa sorte! 2009/1/20 Henrique Machado henri@gmail.com: mais um =) 2009/1/19 Marcelo Andrade mfandr...@gmail.com On Sun, Jan 18, 2009 at 1:03 PM, Delirium tremens pedbe...@gmail.com wrote: Existe mercado de trabalho para programador de CakePHP no Brasil??? Tenho que sair logo. Cara, essa é uma boa pergunta. Eu também sou muito entusiasmado com o Cake e gostaria muitíssimo de trabalhar profissionalmente com ele. Tem chance de trabalho frela internacional no cakephp.org/jobs, mas ainda não consegui nada. Se alguém tiver algo a contribuir, à vontade. PS: ... oi Marcelo, supresa! eu sou brasileiro também!!! hahaha Hehehe... Só para o pessoal entender, é que o Pedro fez uma pergunta na lista gringa e aí ficou dois brasileiros falando um com o outro em ingrês, hehehe. On 18 jan, 13:44, Marcelo Andrade mfandr...@gmail.com wrote: On Sun, Jan 18, 2009 at 12:37 PM, Delirium tremens pedbe...@gmail.com wrote: Flash is called like that because you see the message and seconds later you are redirected, right? Well, my flash does not redirect. Why??? Your debug level at config modifies the flash behaviour. Best regards. Atenciosamente. -- MARCELO DE F. ANDRADE (aka eleKtron) Belem, PA, Amazonia, Brazil Linux User #221105 [...@pará ~]# links http://pa.slackwarebrasil.org/ For Libby's backstory be told on Lost http://www.petitiononline.com/libby423/petition.html -- Att, Everton Yoshitani www.notreve.com +81-80-3660-6560 --~--~-~--~~~---~--~~ 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: XAMMP for Windows with cakePHP
Hello, Depending on your operating system, for example for Linux: sudo mkdir /opt/lampp/htdocs/myproject sudo cp -r ~/myproject/* /opt/lampp/htdocs/myproject sudo chown -R nobody:nobody /opt/lampp/htdocs/myproject Where myproject is the directory for your project. Do not copy cake directly under htdocs/ because it breaks lampp installation. Or if you are using Windows Just make a directory under C;\xampp\htdocs and copy all your code under it. Either case use http://localhost/myproject to access your application. Regards 2009/1/18 Sharmo pe...@ozhonours.com I am not sure if my first post worked. I am therefore posting again. I am using XAMPP for Windows as my localhost server. When I try tho view my application after baking it. There is no CSS or images being renered. I have tred the forums at both XAMPP and PHPVideotutorials without success. Please help. Regards Peter --~--~-~--~~~---~--~~ 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 errors for HABTM model
I'm using a tip I saw recently somewhere (Teknoid?) to validate HABTM on save: $this-MainModel-OtherModel-set($this-data); if (!$this-MainModel-OtherModel-validates()) { $this-MainModel-OtherModel-invalidate('OtherModel'); } else if ($this-MainModel-save($this-data)) { ... OtherModel is named 'Discipline' in this case. That model's $validate: public $validate = array( 'Discipline' = array( 'rule' = 'checkExists', 'message' = 'Please choose at least one discipline.' ) ); public function checkExists() { return !empty($this-data['Discipline']['Discipline']); } So, this appears to be working, except that I can't figure out how to display a message. All I get is 1 (number one). I tried both $form-error('Discipline') and $form-error('Discipline.Discipline') before I thought to dump the $validationErrors in the view, which look like: Array ( [Discipline] = Array ( [Discipline] = 1 ) ) The submitted data looks like this (empty form submission for testing): Array ( [MainModel] = Array ( // empty fields ) [Discipline] = Array ( [Discipline] = ) ) The problem appears to be in Discipline-validate, because the rule isn't on a field. Since Discipline is always a HABTM and only the ID is passed, I changed it to: public $validate = array( 'id' = array( 'rule' = 'checkExists', 'message' = 'Please choose at least one discipline.' ) ); But, now, I don't get any error at all for Discipline. In fact, checkExists doesn't even get used. I next tried: public $validate = array( 'Discipline.Discipline' = array( 'rule' = 'checkExists', 'message' = 'Please choose at least one discipline.' ) ); It still won't run. Cake doesn't seem to want to run the validation rule unless I have just the single model name, and then won't pass the error msg. Ideas? --~--~-~--~~~---~--~~ 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: Yet Another HABTM Save Question
What does the output look like when you have this: if (!empty($this-data)) { die(debug($this-data)); On Mon, Jan 19, 2009 at 7:05 PM, Rob Wilkerson r...@robwilkerson.org wrote: Hey all - I see a lot of questions about this, but nothing I've found references the error I'm seeing so I thought I'd post here and see whether anyone else recognizes what I'm doing wrong. I have an Event model that habtm Attraction: class Event extends AppModel { public $name= 'Event'; public $belongsTo = 'Location'; public $hasAndBelongsToMany = 'Attraction'; ... } class Attraction extends AppModel { public $name = 'Attraction'; public $hasAndBelongsToMany = array ( 'Event' ); ... } In my EventsController, I have: $attractions = $this-Event-Attraction-find ( 'list' ); // the value is being set() later in the controller code And in my view: echo $form-input ( 'Attraction', // I've also tried Attraction.Attraction per the docs array ( 'type' = 'select', 'empty' = true ) ); When I try to save my Event ($this-Event-save ( $this-data ) ), I get this error: SQL Error: 1110: Column 'event_id' specified twice [CORE/cake/libs/ model/datasources/dbo_source.php, line 514] Query: INSERT INTO `attractions_events` (`event_id`,`attraction_id`,`event_id`) VALUES ('4975132e-b0fc-42ee- a13f-9e633b196446','495f9db0- b548-4ee2-94ff-4aebc0a80232','4975132e-7a60-498b-819f-9e633b196446') Anyone have any thoughts? I read and re-read the docs, plus a few habtm blog posts, but I'm not seeing whatever it is I'm doing wrong. I'd appreciate it if someone could point me in the right direction. Thanks. --~--~-~--~~~---~--~~ 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: access the name of the active model in the view
$this-model http://api.cakephp.org/class_view.html On Mon, Jan 19, 2009 at 6:13 PM, FranktheTank frankbirchstu...@gmail.com wrote: Short of performing surgery on the URI, how can I determine the model which has called the current view? I'd like to add it to my default layout so I can automate some tabs. Thanks. Frank --~--~-~--~~~---~--~~ 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: Relationships - HABTM
That depends on what $this-Recipe-recursive is set to. On Mon, Jan 19, 2009 at 4:34 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian one more thing for clarification. My expectation is that if I define the relationships correctly and my DB table are keyed correctly when I call for a read all from the Recipe model I should all related information from all tables no matter how deep the relationship. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 1:13 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM Both Recipe and Ingredient should be HABTM with each other. You can have many recipes which share ingredients. The join table for both would be: ingredients_recipes ingredient_id, recipe_id You could add an id primary key in there, also, as it might come in handy. It's not required, though. As for IngredientList, I'm not sure I've never thought much about doing this with Cake. I guess you could put the amount info, etc. in the ingredients_recipes join table but I'm not sure that'd be the best way. On Mon, Jan 19, 2009 at 12:50 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian thanks for writing back. The ingredient_lists table is where the ingredient, amount and ingredient level instructions are stored. I suppose it's really a join table for recipes, ingredients and measurement_types. So from your reply I should actually rename this to ingredients_recipes. And you are saying that the Ingredient model gets the HABTM instead of Recipe. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 12:26 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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 Check Box Styles
Well, that all depends on your CSS. The first thing you need to do is check the HTML Cake is creating. In my case, where my form has div class=CheckboxGroup $form-select('...', ..., null, array('multiple' = 'checkbox')) /div the result is: div class=CheckboxGroup div class=checkbox input ... type=checkbox label for=../label /div // etc. /div You can set a width on .checkbox and float it to get the result I think you want. On Mon, Jan 19, 2009 at 1:47 PM, WidePixels d...@widepixels.com wrote: Does anyone know how to add a CSS style to the Checkbox? My controller code: $programs = $this-Software-Program-find('list', array('fields' = 'program', 'order' = 'program ASC')); which works as I want. But in the view: echo $form-input('Program',array('multiple'='checkbox')); it just outputs: checkbox {name of program} checkbox {name of program} checkbox {name of program} so on i would like to organize it so it looks more like a table using CSS checkbox {name of program} checkbox {name of program} checkbox {name of program} --~--~-~--~~~---~--~~ 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 Check Box Styles
Still no go. I used echo $form-select('Artists', ..., null, array('multiple' = 'checkbox')); New to this. I am using 1.2 stable. Thanks for your help Dave On Jan 20, 12:56 am, brian bally.z...@gmail.com wrote: Well, that all depends on your CSS. The first thing you need to do is check the HTML Cake is creating. In my case, where my form has div class=CheckboxGroup $form-select('...', ..., null, array('multiple' = 'checkbox')) /div the result is: div class=CheckboxGroup div class=checkbox input ... type=checkbox label for=../label /div // etc. /div You can set a width on .checkbox and float it to get the result I think you want. On Mon, Jan 19, 2009 at 1:47 PM, WidePixels d...@widepixels.com wrote: Does anyone know how to add a CSS style to the Checkbox? My controller code: $programs = $this-Software-Program-find('list', array('fields' = 'program', 'order' = 'program ASC')); which works as I want. But in the view: echo $form-input('Program',array('multiple'='checkbox')); it just outputs: checkbox {name of program} checkbox {name of program} checkbox {name of program} so on i would like to organize it so it looks more like a table using CSS checkbox {name of program} checkbox {name of program} checkbox {name of program} --~--~-~--~~~---~--~~ 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: App::import fail to load Component for imported controller
I think you are getting a little confused between controller and components. Your simplemail function could be placed inside the 'Email' component. And you could use the simplemail function in other controllers by importing the component (and not the controller) App::import('Component','Email') You could treat components as controller helper classes (although they do more than than that). _k10_ On Jan 20, 1:25 am, gerhardsletten gerhardslet...@gmail.com wrote: Writing an app where I was planing to move all email delivering in one controller. When I try to load this Utility controller in a function from another controller. App::import fail to load Email component in this controller Controller 1: code function send_message() { ... App::import('Controller', 'Main'); $main = new MainController; $main-simplemail($to, $subject, $body);} /code Utility controller: code class MainController extends AppController { var $name = 'Main'; var $components = array('Email'); var $uses = null; ... function simplemail($to, $subject, $body) { $mail_settings = Configure::read('Mail'); $this-Email-from = $mail_settings['from_name'] . ' ' . $mail_settings['from_mail'] . ''; $this-Email-to = $to; $this-Email-subject = $subject; debug($this-Email); //$this-Email-send($body); } /code --~--~-~--~~~---~--~~ 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 Check Box Styles
The ellipses in my example were just where I left out implementation details. You need to replace that with the variable holding your list. form-select('Artists', $your_list, null, array('multiple' = 'checkbox')) Also, I just noticed that your controller has: $programs = $this-Software-Program-find(//etc.) Make sure you set that var before rendering the view: $this-set('programs', $programs); You can substitute $programs for the find() call if you don't need to do anything with the list after finding it: $this-set('programs', $this-Software-Program-find(//etc.)); On Mon, Jan 19, 2009 at 11:22 PM, WidePixels d...@widepixels.com wrote: Still no go. I used echo $form-select('Artists', ..., null, array('multiple' = 'checkbox')); New to this. I am using 1.2 stable. Thanks for your help Dave On Jan 20, 12:56 am, brian bally.z...@gmail.com wrote: Well, that all depends on your CSS. The first thing you need to do is check the HTML Cake is creating. In my case, where my form has div class=CheckboxGroup $form-select('...', ..., null, array('multiple' = 'checkbox')) /div the result is: div class=CheckboxGroup div class=checkbox input ... type=checkbox label for=../label /div // etc. /div You can set a width on .checkbox and float it to get the result I think you want. On Mon, Jan 19, 2009 at 1:47 PM, WidePixels d...@widepixels.com wrote: Does anyone know how to add a CSS style to the Checkbox? My controller code: $programs = $this-Software-Program-find('list', array('fields' = 'program', 'order' = 'program ASC')); which works as I want. But in the view: echo $form-input('Program',array('multiple'='checkbox')); it just outputs: checkbox {name of program} checkbox {name of program} checkbox {name of program} so on i would like to organize it so it looks more like a table using CSS checkbox {name of program} checkbox {name of program} checkbox {name of program} --~--~-~--~~~---~--~~ 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: Relationships - HABTM
Ok thanks I will look into the recursive option. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 10:50 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM That depends on what $this-Recipe-recursive is set to. On Mon, Jan 19, 2009 at 4:34 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian one more thing for clarification. My expectation is that if I define the relationships correctly and my DB table are keyed correctly when I call for a read all from the Recipe model I should all related information from all tables no matter how deep the relationship. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 1:13 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM Both Recipe and Ingredient should be HABTM with each other. You can have many recipes which share ingredients. The join table for both would be: ingredients_recipes ingredient_id, recipe_id You could add an id primary key in there, also, as it might come in handy. It's not required, though. As for IngredientList, I'm not sure I've never thought much about doing this with Cake. I guess you could put the amount info, etc. in the ingredients_recipes join table but I'm not sure that'd be the best way. On Mon, Jan 19, 2009 at 12:50 PM, Steven Wright rhythmicde...@gmail.com wrote: Hi Brian thanks for writing back. The ingredient_lists table is where the ingredient, amount and ingredient level instructions are stored. I suppose it's really a join table for recipes, ingredients and measurement_types. So from your reply I should actually rename this to ingredients_recipes. And you are saying that the Ingredient model gets the HABTM instead of Recipe. Is that correct? -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of brian Sent: Monday, January 19, 2009 12:26 PM To: cake-php@googlegroups.com Subject: Re: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right direction. So am I missing something here? Wrong relationship definition? Wrong expectation? Thanks in advance. Steve I have the following models and relationship definitions: Recipe var $hasAndBelongsToMany = array( 'Ingredient' = array( 'className' = 'Ingredient', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'ingredient_id', 'unique' = true ), 'MeasurementType' = array( 'className' = 'MeasurementType', 'joinTable' = 'ingredient_lists', 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'measurement_type_id', 'unique' = true ) ); IngredientList var $belongsTo = array('Recipe', 'MeasurementType'); Ingredient var $belongsTo = 'IngredientType'; I don't understand what you're doing with the ingredient_lists table. But your ingredient model, at least, should HABTM Recipe. Ingredient var $hasAndBelongsToMany = array('Recipe'); And the join table should be ingredients_recipes. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---