Re: Acl - inconsistent behaviour when accessing an unauthorised url
Hi there, just bumping this - I would have thought that someone may have some insight into an important core part of the framework misbehaving? On Apr 12, 9:31 am, Tonu Tusk lvot...@googlemail.com wrote: Hi guys, I have had problems with this in the past (with a workable hack which might break things in the future) Basically, I have the following scenario. I have Auth and Acl setup as in the tutorial (actions based authentication) now if I have an authenticated user but who has restricted access to a url mysite.com/restricted/page I get a variety of behaviours based on how I access the page. If I try to access the page whilst not logged on and then logging on, I get a redirect, If I am logged on and directly enter the url (no referer) I get redirected to home ('/') and if I try to access the restricted page via a link in an accessible page in the app, nothing happens (well obviously cake is restricting access and then redirecting me to the referer which is the page I am already on) Ideally, I would like the option o being able to be redirected to an unauthorised notification page if I chose, but I want to be able to catch all of the above occurrences without hacking auth.php My simple solution is just to implement AppController::referer() to always return my unauthorised notification page - the cirucmstances I have found out of the box that result in it being used for a redirection meet my criteria, but this is obviously flaky testing, and also then restricts the possibility of me using referer for anything else in the app in the future. The second solution (currently) is adding extra logic to the login function (to catch some special case redirections), moving the authentication type to controller and implementing AppController isAuthorized() to basically manually pass the current data through to Acl::Check, but in the process, internally flagging up if an unauthorized page has been requested and no page had yet been rendered as a result of any redirects, and then using this flag in the implemented referer method to try and retain referer's standard behaviour wherever possible. This just seems really long winded, and as noted before, is going to be a nightmare to test for all possible scenarios of the use of app. Surely with the imminent release of 1.3 there should not have to be workarounds for such a fundamental component, or am I missing something? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: SQL injection protect
Thank you for your help Sergei. It really helpfull. I use this validation in many controllers, thats why I wrote component for it. I have too much urls in my project, where last parameter is a digit - unsigned int. And I need to validate it and show error message to user if parameter is wrong. I don't know better way to validate it :( On Apr 14, 4:01 am, Sergei yatse...@gmail.com wrote: Dmitry, don't think, look at the source :) updateAll is exactly the answer. Your validation routine seems too heavy for one number. And you don't have to create a component to validate some data manually. You can always validate in controller. On Apr 14, 12:15 am, Dmitry Shevchenko dmitr...@gmail.com wrote: Sergei I think updateAll didn't sanitize data -http://book.cakephp.org/view/75/Saving-Your-Data or I'm wrong? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: News with Comments - how to sort by comments count?
I would recommend using counterCache if regularly sorting data by count, it's much more efficient hence why it;s included in Cake's automagic. http://book.cakephp.org/view/816/counterCache-Cache-your-count HTH Paul Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: need help saving cross reference table
No problem :) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
CouchDB as a datasource
Hi everyone, As a year-old CakePHP user (by the way : huge congrats to the core team for keeping up such a pretty framework!) I'm considering to replace MySQL by CouchDB. I had a dream where some unpredictable data wouldn't require ugly schemas :) So far I tried gwoo's datasource (http://bin.cakephp.org/view/ 925615535 - see also the original topic [1]) This is a good start but it assumes that a couchDB database is the counterpart of MySQL tables. I don't think so, as it's usual in CouchDB to put a type field in documents : then the counterpart of the table is rather a couch view (or sometimes show or list) which picks up document sets. A CouchDB view sound like a good counterpart to find('all', ...) I tried to rewrite a datasource (if needed I can publish it on cakebin today), keeping in mind that it would be tied to a single couchdb database. BUT I found out that schemas are deeply implemented in the Model class :/ so Cake started to call my source's listSources, describe and column methods. Of course I couldn't implement these methods as my DB doesn't have schemas... I tried to set useTable to false in the Model but then it won't save anything. So I'm stuck between a normal CouchDB use (a single DB for my whole app + calls to views in mind) which doesn't seem cake-friendly and a working datasource that puts some constraints on DB design. That's why I would like to discuss it here. Any comments are welcome! Martin [1] original topic about cake+couch : http://groups.google.com/group/cake-php/browse_thread/thread/f0eaa55149d7ddb3/bff40dbc700171f9 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: News with Comments - how to sort by comments count?
I would recommend using counterCache if regularly sorting data by count, it's much more efficient hence why it;s included in Cake's automagic. http://book.cakephp.org/view/816/counterCache-Cache-your-count That's a good idea :) -- jon bennett - www.jben.net - blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Can I stop the page from re-rendering after a form submission?
I have a question which may be very basic - I'm not sure whether I've just tied my brain in knots from thinking about it! Apologies if so. I have a form which has various buttons. One of them is a 'Preview', which pops up a new window (well, a PDF) when clicked. At the moment, there is some javascript going on, which enables and disables various buttons when the page is loaded. However, if the Preview button is clicked, I don't want the page to reload afterwards, because it will then apply these changes to the buttons, which I don't want... Cake seems to insist that I have to go somewhere after form submission (and for all the other buttons it does a reload of the current page, which is fine), so is there a way to stop this from happening? I hope that makes sense; I'm not sure I've explained it very well, but as I say, my brain is confused! Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Searching whole database
Hello, I wanted to ask for suggestions regarding a search page. I have a DB with articles which belongsTo authors and HABTM categories. I want a simple search box with some category check boxes, where I can search for the given words. Now I have a $this-paginate with two models. Like : $this-paginate = array( 'Article'=array( 'limit' = $this-_limit, 'conditions' = array( 'OR' = $searchArrayOR), 'contain'=array('UserUpload','Translation','Category','Author') ), 'ArticlesCategory' =array( 'limit' = $this-_limit, 'recursive' = 1, 'conditions' = array( 'AND' = array('Category.id' = $caategoryIN), 'OR' = $searchArrayOR), 'contain' = array('Category','Article','Article.Author', 'Article.UserUpload','Article.UserTranslated') ) ); If a user has checked on or more categories I paginate ArticlesCategory, else Articles. If I want to search also in Authors than I should create another pagination model. But instead of this isn't it better to run a custom query with the apropriate joins? An in case of a custom query how can I employ pagination using the pagination helper? How do you cope with such searches? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Quick habtm problem
Hey all, Going a bit crazy here I think I need a break from this. Anyways, I have the following tables + relationships Judges MediaSegments (a category that the judge is selected to judge) JudgesMediaSegments (contains judge_id and media_segment_id) How would I find all the judges that belong to a specific media segment? I know its something really simple I just cannot seem to get it right. Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Sample files?
Not quite sure what you want, but if you want the app part of CakePHP, then just download the CakePHP source code and take the app part from that. For example the 1.2.x version can be downloaded from here: http://github.com/cakephp/cakephp1x/archives/1.2 If that is not what you want, then please clarify! Enjoy, John On Apr 13, 6:55 pm, Validatorian validator...@gmail.com wrote: I found a link for 'test cases' leading to '/test' which was a broken link -- could anyone help me out with a link to where I can find complete cakePHP code for applications? For what it's worth, I'm currently working out how to design my code to support modular plugins -- I want to just be able to drop them in and have them affect the output of existing pages, without directly editing the core files (this will be utilized by many people, few of which have any technical proficiencies) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Quick habtm problem
Are you using Containable behaviour? You should be! Try this...(typed without testing - so go easy on me if it's wrong!)... From the MediaSegment controller: $this-MediaSegment-find( 'all', array( 'contain' = array( 'Judge' ), 'conditions' =array( 'MediaSegment.id' = $id ) ) ); From the judges controller: $this-Judge-MediaSegment-find( 'all', array( 'contain' = array( 'Judge' ), 'conditions' =array( 'MediaSegment.id' = $id ) ) ); From within a model, just omit the first Model in the find statement (so $this-find()) Jeremy Burns jeremybu...@me.com On 14 Apr 2010, at 14:37, Bryan Paddock wrote: Hey all, Going a bit crazy here I think I need a break from this. Anyways, I have the following tables + relationships Judges MediaSegments (a category that the judge is selected to judge) JudgesMediaSegments (contains judge_id and media_segment_id) How would I find all the judges that belong to a specific media segment? I know its something really simple I just cannot seem to get it right. Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: table naming convention
In your UsersController, your models name is not adb_ but User. In your view, your models name is not adb_ but User. Please change accordingly and tell us how it went. Enjoy, John On Apr 13, 9:19 am, Master Ram ramganga...@gmail.com wrote: hi.. my table Name:adb_users this is my: view form: h3Register/h3 ?php echo $form-create('adb_', array('action' = 'register'));? ?php echo $form-input('username');? ?php echo $form-input('password');? ?php echo $form-input('email');? ?php echo $form-input('date');? ?php echo $form-submit('Register');? ?php echo $form-end(); ? Model: ?php class User extends AppModel { var $tablePrefix = 'adb_';//var $name = 'User'; } ? Controller: ?php class UsersController extends AppController { var $tablePrefix = 'adb_';//var $name = Users; var $helpers = array('Html', 'Form'); function register() { if (!empty($this-data)) { $this-adb_-create();// its not entering in to this step; $this-data['adb_']['username']; $this-data['adb_']['password']= md5($this-data['adb_']['password']); $this-adb_-save($this-data); // $this-set('userMessage', 'Team successfully added!'); $this-redirect(array('action'='index')); } } help me how to assing table in view. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Can I stop the page from re-rendering after a form submission?
'onClick' = 'return false;' would do the trick I suppose. :) On Apr 14, 1:02 pm, WhyNotSmile sharongilmor...@googlemail.com wrote: I have a question which may be very basic - I'm not sure whether I've just tied my brain in knots from thinking about it! Apologies if so. I have a form which has various buttons. One of them is a 'Preview', which pops up a new window (well, a PDF) when clicked. At the moment, there is some javascript going on, which enables and disables various buttons when the page is loaded. However, if the Preview button is clicked, I don't want the page to reload afterwards, because it will then apply these changes to the buttons, which I don't want... Cake seems to insist that I have to go somewhere after form submission (and for all the other buttons it does a reload of the current page, which is fine), so is there a way to stop this from happening? I hope that makes sense; I'm not sure I've explained it very well, but as I say, my brain is confused! Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Sample files?
Check out the Just Baked section of the CakePHP front page: http://cakephp.org/ Then visit GitHub and search for 'CakePHP' there. That's probably what you want? :) Croogo is a good example of a pluggable plugins CakePHP app. On Apr 13, 5:55 pm, Validatorian validator...@gmail.com wrote: I found a link for 'test cases' leading to '/test' which was a broken link -- could anyone help me out with a link to where I can find complete cakePHP code for applications? For what it's worth, I'm currently working out how to design my code to support modular plugins -- I want to just be able to drop them in and have them affect the output of existing pages, without directly editing the core files (this will be utilized by many people, few of which have any technical proficiencies) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Can I stop the page from re-rendering after a form submission?
Cake doesn't insist on anything. The nature of clicking a submit button in a form is to submit the form. That means the browser sends the post/get request to the server and loads the response. If you want different behavior, you need to catch the submit event through JavaScript and cancel it. The most basic way is form ... onsubmit=return false;, although this would block all submissions. You can do onsubmit=return someFunction(); and have someFunction return true if you want to submit the form, and return false if you don't. Or you can use a library, like jQuery, and do something along the lines of $ ('form').submit(function(e) { ... }); and conditionally call e.preventDefault() if you don't want to submit the form. You can also look into Cake's JavaScript helper. On Apr 14, 7:02 am, WhyNotSmile sharongilmor...@googlemail.com wrote: I have a question which may be very basic - I'm not sure whether I've just tied my brain in knots from thinking about it! Apologies if so. I have a form which has various buttons. One of them is a 'Preview', which pops up a new window (well, a PDF) when clicked. At the moment, there is some javascript going on, which enables and disables various buttons when the page is loaded. However, if the Preview button is clicked, I don't want the page to reload afterwards, because it will then apply these changes to the buttons, which I don't want... Cake seems to insist that I have to go somewhere after form submission (and for all the other buttons it does a reload of the current page, which is fine), so is there a way to stop this from happening? I hope that makes sense; I'm not sure I've explained it very well, but as I say, my brain is confused! Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: How to pass an array trough URL??
I have the same problem, but your trick doesn't work for me in 1.3 RC3.. $passedArgs is empty.. Any ideas on how to pass an array in the URL? Johannes On 29 mrt, 18:04, toka...@gmail.com toka...@gmail.com wrote: I have solved it. pretty simple. examples.com/:controller/:action/? names[]=Johnnames[]=Tomasnames[]=Susan then just call $this-params['url'] to get your array 'names'. PS: you can also do nested arrays like names[0] [email]=j...@example.comnames[1][email]=. Tomas On 29 bře, 11:59, toka...@gmail.com toka...@gmail.com wrote: Hi, is there a chance to pass simple array via URL? http://example.com/name:John/name:Tom/name:Susan Then I should recieve back my array of names array('John', 'Tom', 'Susan'); Any idea how the URL should look like? Thanks Tomas Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: How to pass an array trough URL??
This doesn't work for me in 1.3 RC3. Any ideas on how to pass an array to passedArgs in URL in Cake 1.3? Johannes (Sorry if this message appeared twice, I can't see if it's been posted already.) On 29 mrt, 18:04, toka...@gmail.com toka...@gmail.com wrote: I have solved it. pretty simple. examples.com/:controller/:action/? names[]=Johnnames[]=Tomasnames[]=Susan then just call $this-params['url'] to get your array 'names'. PS: you can also do nested arrays like names[0] [email]=j...@example.comnames[1][email]=. Tomas On 29 bře, 11:59, toka...@gmail.com toka...@gmail.com wrote: Hi, is there a chance to pass simple array via URL? http://example.com/name:John/name:Tom/name:Susan Then I should recieve back my array of names array('John', 'Tom', 'Susan'); Any idea how the URL should look like? Thanks Tomas Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Can I create many ajax form in the same page?
Can I create many ajax form in the same page? I tried this but in the second form submit the auth sessios is lost and i redirected to login page PS. Sorry for my english Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Session
hi folks im having problems with php sessions. i used session_start() in my site and this error comes up: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www \muangoleshop\login.php:9) in C:\wamp\www\muangoleshop\login.php on line 22 somebody help me please Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Session
If possible, I would use the session helper rather than managing the session directly: http://book.cakephp.org/view/1465/Session As far as your error goes, I'm slightly confused you ended up with a login.php page? Cake doesn't work that way. Jeremy Burns jeremybu...@me.com On 14 Apr 2010, at 13:00, frederica wrote: hi folks im having problems with php sessions. i used session_start() in my site and this error comes up: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www \muangoleshop\login.php:9) in C:\wamp\www\muangoleshop\login.php on line 22 somebody help me please Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Can I stop the page from re-rendering after a form submission?
Thanks everyone. I figured it out - I created the view page to generate the PDF, which then pops up automatically and leaves the old view in place. Thanks again. On Apr 14, 3:42 pm, Andy Dirnberger andy.dirnber...@gmail.com wrote: Cake doesn't insist on anything. The nature of clicking a submit button in a form is to submit the form. That means the browser sends the post/get request to the server and loads the response. If you want different behavior, you need to catch the submit event through JavaScript and cancel it. The most basic way is form ... onsubmit=return false;, although this would block all submissions. You can do onsubmit=return someFunction(); and have someFunction return true if you want to submit the form, and return false if you don't. Or you can use a library, like jQuery, and do something along the lines of $ ('form').submit(function(e) { ... }); and conditionally call e.preventDefault() if you don't want to submit the form. You can also look into Cake's JavaScript helper. On Apr 14, 7:02 am, WhyNotSmile sharongilmor...@googlemail.com wrote: I have a question which may be very basic - I'm not sure whether I've just tied my brain in knots from thinking about it! Apologies if so. I have a form which has various buttons. One of them is a 'Preview', which pops up a new window (well, a PDF) when clicked. At the moment, there is some javascript going on, which enables and disables various buttons when the page is loaded. However, if the Preview button is clicked, I don't want the page to reload afterwards, because it will then apply these changes to the buttons, which I don't want... Cake seems to insist that I have to go somewhere after form submission (and for all the other buttons it does a reload of the current page, which is fine), so is there a way to stop this from happening? I hope that makes sense; I'm not sure I've explained it very well, but as I say, my brain is confused! Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Session
This is a group about CakePHP, a very capable framework, not just PHP. So if you're looking for general PHP wisdom, I think you need to look elsewhere. If it isn't CakePHP related I mean. And it does sound like it's not. :) On Apr 14, 2:00 pm, frederica frederica.lop...@gmail.com wrote: hi folks im having problems with php sessions. i used session_start() in my site and this error comes up: Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\wamp\www \muangoleshop\login.php:9) in C:\wamp\www\muangoleshop\login.php on line 22 somebody help me please Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
AppController being cached?
Hi guys, I'm having a little problem with my AppController in production environment. Any change I make on it is reflected locally, but not when in production! I tried do delete the app_controller.php file, invalidate its syntax and nothing happens. The application still behaves the same way as before. Any change in any other file is instantly reflected. I've been dealing with this since yesterday. What can be happening? Thank you so much. Lucca Mordente Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: AppController being cached?
Try deleting the files in /app/tmp/cache/persistent (and models too for good measure). Jeremy Burns jeremybu...@me.com On 14 Apr 2010, at 16:18, Lucca Mordente wrote: Hi guys, I'm having a little problem with my AppController in production environment. Any change I make on it is reflected locally, but not when in production! I tried do delete the app_controller.php file, invalidate its syntax and nothing happens. The application still behaves the same way as before. Any change in any other file is instantly reflected. I've been dealing with this since yesterday. What can be happening? Thank you so much. Lucca Mordente Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: AppController being cached?
All cached files deleted and nothing... On 14 abr, 12:20, Jeremy Burns jeremybu...@me.com wrote: Try deleting the files in /app/tmp/cache/persistent (and models too for good measure). Jeremy Burns jeremybu...@me.com On 14 Apr 2010, at 16:18, Lucca Mordente wrote: Hi guys, I'm having a little problem with my AppController in production environment. Any change I make on it is reflected locally, but not when in production! I tried do delete the app_controller.php file, invalidate its syntax and nothing happens. The application still behaves the same way as before. Any change in any other file is instantly reflected. I've been dealing with this since yesterday. What can be happening? Thank you so much. Lucca Mordente Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
general model association/SQL question: linking one table to many others
Hi! I have a table phrases. It has fields id as INT and value as TEXT. This table is used to store different phrases or sentences. Now I want to describe a car with a model name and description. I want both these values to reference phrases table. In my opinion Car hasOne name and hasOne description. But it seems that in SQL/CakePHP notation it is not true. To make hasOne in Cake I would need to add field car_id in my phrases table. Then if I introduce the table cities also with name and description, I would need additional rows in phrases table... I think that I can create additional tables cars_names and cars_descriptions and connect them through HABTM association with cards and phrases. But I find inconvenient to create additional table for every phrase field I want to add. Maybe someone knows what can I do in this situation? Regards, Vadim. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Database sessions in version 1.3
thank you dear pals, especially, your last messages are very helpful... in addition, I am not agree with you, jacmoe. the book is not fairly up to date for a newcomer. little things can confuse newcomers brains. but after all, (as you said) its better to continue with 1.3... because I see that there is a very friendly community to get help... thank you very much again. On 14 Nisan, 07:46, jacmoe jac...@mail.dk wrote: I checked, and running 'cake schema create Sessions' does create a cake_sessions table in your database. You can do this! :) That book is actually fairly up to date and complete. :) Beware that in two weeks time, CakePHP 1.3 will become the current stable version. So you better get used to it. On Apr 14, 5:24 am, zonery ikiz...@gmail.com wrote: thank you for your interest. its better to continue with ver.1.2.6... because I am newcomer and the book is very important for me.. it seems ver.1.3 book must be updated.. thank you again... On 14 Nisan, 04:20, jacmoe jac...@mail.dk wrote: It's cake schema create Session, isn't it? On Apr 14, 2:13 am, zonery ikiz...@gmail.com wrote: dear Jeremy Burns, I am not asking about version 1.2.6... My question is about version 1.3 and there is no sql folder under /app/config/... I download ver.1.3 now, and checked again... there is no sql folder and sql file... there is only schema folder under /app/config/ could you look again and advice me.. thank you On 13 Nisan, 14:32, Jeremy Burns jeremybu...@me.com wrote: It's in /app/config/sql/sesions.sql Jeremy Burns jeremybu...@me.com On 13 Apr 2010, at 04:52, zonery wrote: hi all, I want to store sessions in database. in 1.3 manual (http://book.cakephp.org/view/1310/Sessions), it says ...run thedatabase sessionSQL file located in app/ config... but there is nodatabase sessionsql file in app/config how can I create session database table (or get schema)? can I use app/config/sql/sessions.sql file in ver.1.2.6, for ver.1.3 thank you note: sorry my bad english Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpotherswiththeir CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: CouchDB as a datasource
If you're interested here is my current try : http://bin.cakephp.org/view/1461894980 it's not complete and doesn't work... Martin On Apr 14, 10:56 am, Martin Kirchgessner martin.kirchgess...@orego.fr wrote: Hi everyone, As a year-old CakePHP user (by the way : huge congrats to the core team for keeping up such a pretty framework!) I'm considering to replace MySQL by CouchDB. I had a dream where some unpredictable data wouldn't require ugly schemas :) So far I tried gwoo's datasource (http://bin.cakephp.org/view/ 925615535 - see also the original topic [1]) This is a good start but it assumes that a couchDB database is the counterpart of MySQL tables. I don't think so, as it's usual in CouchDB to put a type field in documents : then the counterpart of the table is rather a couch view (or sometimes show or list) which picks up document sets. A CouchDB view sound like a good counterpart to find('all', ...) I tried to rewrite a datasource (if needed I can publish it on cakebin today), keeping in mind that it would be tied to a single couchdb database. BUT I found out that schemas are deeply implemented in the Model class :/ so Cake started to call my source's listSources, describe and column methods. Of course I couldn't implement these methods as my DB doesn't have schemas... I tried to set useTable to false in the Model but then it won't save anything. So I'm stuck between a normal CouchDB use (a single DB for my whole app + calls to views in mind) which doesn't seem cake-friendly and a working datasource that puts some constraints on DB design. That's why I would like to discuss it here. Any comments are welcome! Martin [1] original topic about cake+couch :http://groups.google.com/group/cake-php/browse_thread/thread/f0eaa551... Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
$html-tableCells
Looking at the section in the book for $html-tableCells it says ... Wrap a single table cell within an array() for specific td-attributes. $html-tableCells(array('foo', 'bar')); will ouput tr tdfoo/td tdbar/td /tr I'm having a few issues with this one. Could someone give me a quick example of how to output the same code utilizing a td attrib. ? Ie. tr td valign=topfoo/td tdbar/td /tr Thanks, - Ed Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: $html-tableCells
Hi Ed, Probably you can achieve what you want using css. It seems that isn't possible to add attributes using this html helper method. Lucca Mordente On 14 abr, 16:57, Ed Propsner crotchf...@gmail.com wrote: Looking at the section in the book for $html-tableCells it says ... Wrap a single table cell within an array() for specific td-attributes. $html-tableCells(array('foo', 'bar')); will ouput tr tdfoo/td tdbar/td /tr I'm having a few issues with this one. Could someone give me a quick example of how to output the same code utilizing a td attrib. ? Ie. tr td valign=topfoo/td tdbar/td /tr Thanks, - Ed Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: CouchDB as a datasource
Hi Martin, If you're interested here is my current try : http://bin.cakephp.org/view/1461894980 it's not complete and doesn't work... If you like Cake's take on MVC and want to stick with php, then the fork of Cake 3 Lithium has a pretty stable CouchDB datasource http://rad-dev.org/lithium_bin hth (and doesn't miff any cakers for pointing in a different direction!). J -- jon bennett - www.jben.net - blog.jben.net Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Cake won't save my data
I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php: http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp: http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump: http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: $html-tableCells
In all honesty it's easier to write out the html tags ... I was just playing around it. Am I reading it wrong or does the book give you the impression that it can be done? http://book.cakephp.org/view/1435/Inserting-Well-Formatted-elements On Wed, Apr 14, 2010 at 4:13 PM, Lucca Mordente luccamorde...@gmail.comwrote: Hi Ed, Probably you can achieve what you want using css. It seems that isn't possible to add attributes using this html helper method. Lucca Mordente On 14 abr, 16:57, Ed Propsner crotchf...@gmail.com wrote: Looking at the section in the book for $html-tableCells it says ... Wrap a single table cell within an array() for specific td-attributes. $html-tableCells(array('foo', 'bar')); will ouput tr tdfoo/td tdbar/td /tr I'm having a few issues with this one. Could someone give me a quick example of how to output the same code utilizing a td attrib. ? Ie. tr td valign=topfoo/td tdbar/td /tr Thanks, - Ed Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
getting a 3rd-hand database value without recursive = 2
Situation: Viewing a service. A service has credentials. Credentials have a credential type. I'm using $service = $this-Service-findById($id); to set all the data for my view. I have all the database associations set up correctly (I think): Service hasMany Credential. Credential belongsTo Service, CredentialType. CredentialType hasMany Credential. How can I get it to retrieve CredentialType.title, so I can display the title instead of the Credential.credential_type_id value, which is worthless to a person viewing the service? I really don't want to use recursive = 2 (although it works), because it creates enormous database overhead! (55 queries vs. 25) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Cake won't save my data
I've checked with the folks in the IRC, and it looks like Cake shouldn't care if I'm using InnoDB, but my data still won't show up in the tables regardless of Cake giving me every indication that the save was successful. On 14 Apr, 16:43, Johnny Ferguson hyperfle...@gmail.com wrote: I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump:http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
RE: Cake won't save my data
In your practice_items_controller.php your pr should not have the lowercase and underscored array element. Check your form or wherever you're assigning this array and your pr should look like Array ( [PracticeItem] = Array ( [name] = Test [description] = Test ) ) PracticeItem is the Model Name This is part of the whole convention over configuration. Alan -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Johnny Ferguson Sent: Wednesday, April 14, 2010 2:10 PM To: CakePHP Subject: Re: Cake won't save my data I've checked with the folks in the IRC, and it looks like Cake shouldn't care if I'm using InnoDB, but my data still won't show up in the tables regardless of Cake giving me every indication that the save was successful. On 14 Apr, 16:43, Johnny Ferguson hyperfle...@gmail.com wrote: I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump:http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cake won't save my data
Thanks Alan, my table is definitely being populated now. I've fixed up the controller names to follow the convention. On my PracticeItems/index view I have created a link to the add form like so: echo $html-link('add new item', array('controller' = 'PracticeItems', 'action' = 'add')); When I arrive at the page, the url is /cakeRoot/PracticeItems/add When the form submits, the url changes to /cakeRoot/practice_items/add Why won't $html-link put the url in the conventional format? (practice_items) Would it make more sense to say echo $html-link('add new item', array('controller' = 'practice_items', 'action' = 'add')); in order to keep with convention? Furthermore, when I enable the redirect in practice_items_controller.php, I get an error when the redirect executes. The redirect line is as follows: $this-redirect(array('action' = 'index')); which should take me to /cakeRoot/PracticeItems/index, but instead I get the error: Warning (2): Cannot modify header information - headers already sent by (output started at /var/www/go/htdocs/practicelog/cake/basics.php: 306) [CORE/cake/libs/controller/controller.php, line 644] EDIT: I fixed this issue by disabling the line that said $this-set('debug', pr($this-data)); It would seem sending data to the view makes a redirect impossible. I've included this in case anyone has a similar issue in the future. On 14 Apr, 17:17, Alan Asher a...@asteriskpound.com wrote: In your practice_items_controller.php your pr should not have the lowercase and underscored array element. Check your form or wherever you're assigning this array and your pr should look like Array ( [PracticeItem] = Array ( [name] = Test [description] = Test ) ) PracticeItem is the Model Name This is part of the whole convention over configuration. Alan -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Johnny Ferguson Sent: Wednesday, April 14, 2010 2:10 PM To: CakePHP Subject: Re: Cake won't save my data I've checked with the folks in the IRC, and it looks like Cake shouldn't care if I'm using InnoDB, but my data still won't show up in the tables regardless of Cake giving me every indication that the save was successful. On 14 Apr, 16:43, Johnny Ferguson hyperfle...@gmail.com wrote: I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump:http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Multiple prefix routes. Second route not working.
Damn, still trying to figure this out. I did make some headway although I still get the error where its looking for the prefixroute_controller instead of the real_controller with the prefixroute_action function. Anybody with any ideas? On Wed, Apr 14, 2010 at 2:02 AM, Bryan Paddock bryanpadd...@gmail.comwrote: Hey all, I have an application that has been running for a while using admin routing. There are normal users as well as admin users. Now the application is growing and I need to create separate judging routes for judges that will log in and moderate the submissions. In my *core.php* I have the following line: Configure::write('Routing.admin', 'admin'); To which I added the new one: Configure::write('Routing.judge', 'judge'); In my *routes.php* I have the following route: Router::connect('/admin', array('controller' = 'submissions', 'action' = 'control', 'admin' = true), array('language' = 'us')); To which I added the judging one: Router::connect('/judge', array('controller' = 'submissions', 'action' = 'control', 'judge' = true), array('language' = 'us')); *submissions_controller.php* has the admin_control function which works. The judge_control does not. In fact the whole route is broken. Upon trying to access *site.com/judge* I get the error about SubmissionsController:control() not found. Does anyone know why it would not be trying to access SubmissionsController:judge_control() ? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Quick habtm problem
Ah! Thank you! After a while of tinkering with your code I realised I had the $actsAs in the controller and not the model :( Works like a charm. I've modified all of my code now to use containable behaviour. Gone with recursive = -1. On Wed, Apr 14, 2010 at 3:45 PM, Jeremy Burns jeremybu...@me.com wrote: Are you using Containable behaviour? You should be! Try this...(typed without testing - so go easy on me if it's wrong!)... From the MediaSegment controller: $this-MediaSegment-find( 'all', array( 'contain' = array( 'Judge' ), 'conditions' =array( 'MediaSegment.id' = $id ) ) ); From the judges controller: $this-Judge-MediaSegment-find( 'all', array( 'contain' = array( 'Judge' ), 'conditions' =array( 'MediaSegment.id' = $id ) ) ); From within a model, just omit the first Model in the find statement (so $this-find()) Jeremy Burns jeremybu...@me.com jeremybu...@mac.com On 14 Apr 2010, at 14:37, Bryan Paddock wrote: Hey all, Going a bit crazy here I think I need a break from this. Anyways, I have the following tables + relationships Judges MediaSegments (a category that the judge is selected to judge) JudgesMediaSegments (contains judge_id and media_segment_id) How would I find all the judges that belong to a specific media segment? I know its something really simple I just cannot seem to get it right. Thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: general model association/SQL question: linking one table to many others
On Apr 14, 12:34 pm, Vadim Frolov fra...@gmail.com wrote: Hi! I have a table phrases. It has fields id as INT and value as TEXT. This table is used to store different phrases or sentences. Now I want to describe a car with a model name and description. I want both these values to reference phrases table. In my opinion Car hasOne name and hasOne description. But it seems that in SQL/CakePHP notation it is not true. To make hasOne in Cake I would need to add field car_id in my phrases table. Then if I introduce the table cities also with name and description, I would need additional rows in phrases table... I think that I can create additional tables cars_names and cars_descriptions and connect them through HABTM association with cards and phrases. But I find inconvenient to create additional table for every phrase field I want to add. This is a bit backwards but I think it would work. Car model: var $belongsTo = array( 'CarName' = array( 'className' = 'Phrase', 'foreignKey' = 'name_id' ), 'CarDescription' = array( 'className' = 'Phrase', 'foreignKey' = 'description_id' ) ); The scenario you describe seems a little messy though. Maybe there's a better approach. Does this concern translations? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Is there a way to speed up cake for a high traffic website ( Cake + Postgres )
you can optimize your cake so it not always query to sql everytime user access the same data. you can do it with memcache, cake cache component with time caching method, so if your data is not always changing, like in 1 hour you got 1 update, you can cache it in your memcache, and in the app caching, make it query against db in 1 hour ... it a lot of optimization in my apps... cause user need the same data anyway..and 500 user query the same data in 1 minute is a lot of resource.. but with cahce, you retreive it once from db, use it all the time, and update it in the time set up for it.. On Tue, Apr 13, 2010 at 2:07 AM, altermod localmotion...@gmail.com wrote: I think I just need to turn off transactions since I'm using Postgresql. I get 2 transaction queries Begin / Rollback on pages where I make no db queries. This is definitely not necessary. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Find() returns different formatted array when using Postgresql vs Mysql ( any way to resolve this? )
When I do a find and get 1 row back in Postgres it has to be referenced like $data[0][email] whereas in Mysql you can do $data[Account][email]. I just migrated from Mysql to Postgres so I just have to go thru and change all single result queries that formerly worked in Mysql as $data[Account][email] to $data[0][email] in Postgres. Or is there something I'm doing wrong here? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Help Me about REST
I'm can't make REST in cakePHP. I follow step by step http://bakery.cakephp.org/articles/view/restful-web-services-with-cakephp, but this way can't. What do you have tutorial about REST? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: REST in cakePHP
I'am very confused with step by step to setup REST. You have the best tutorial all about REST cakePHP? i hope, i have it. I hope this tutorial can guide me ste by step until finished develop REST. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
cached views have strange names
I have been having a problem with cached views in 1.3 RC4. First, I noticed that when editing or adding a record none of the cached was cleared at all, not for the direct model or associated models. I then took a look at the cache/views folder and noticed the names of the cached files were way different from what I saw before in previous version of cake. I can't make heads or tails of where cake is getting the name from, but here is an example of a cached file name: lm_t_l_ll_t_o_d_d_ml.php. Before, cake would name cached views with something along the following convention: location_cms_gallery_categories_index_index_xml. Anyhow, back to cache not clearing problem. I went ahead and manually changed one of the strangely named view files to the convention I have seen before and then updated an associated record. Much to my suprse, the manually named file was cleared! The main question here are: 1. Where is cake getting the strange names from? 2. How can I configure cake to name the cache files accordingly? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Routing based on logged in user
So here I am, developing my first web application using Cake. And what a wonderful experience it has been so far :) Now I'm wondering: I want my site root to be two different controllers/ actions. One for when no user is logged in and one for when someone has provided valid login credentials. I tried it with $this-LoadsysAuth-User('id') but that doesn't work. I get an Undefined property: Dispatcher::$LoadsysAuth error. Is there a way to actually do this? Can it be done from the routes.php file or do i need to alter a controller somewhere? Only important thing is that the url doesn't contain any parameters. Thanks, Joost Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Cake won't save data in $this-data (data relationship weirdness)
Hi, I'm developing an app that has database relationships. The table in question is like so: tbl practice_instances id - int (primary) created - timestamp (default: null) modified - timestamp (default: null) timeminutes - int practice_session_id - int practice_item_id - int tempostart - int tempofinish - int practice_session_id refers to an entry in the PracticeSession model (PracticeSession hasMany PracticeInstance) practice_item_id refers to an entry in the PracticeItem model (PracticeInstance belongsTo PracticeItem) I have a form under /cakeRoot/practice_instances/add which accepts the following fields: ?php echo $form-create(PracticeInstance); echo $form-input(timeminutes); echo $form-input(practice_session_id); echo $form-input(practice_item_id); echo $form-input(tempostart); echo $form-input(tempofinish); echo $form-end(Create Practice Instance); ? When I submit the form, I can see in my controller dump: [data] = Array ( [PracticeInstance] = Array ( [timeminutes] = 20 [practice_session_id] = 42 [practice_item_id] = 3 [tempostart] = 120 [tempofinish] = 128 ) ) So everything is fine there, but when I look in my table, all the fields other than id, created, and modified are set to a value of 0. This is odd because cake is telling me that it saved $this-data, and as you can see, the values above are not zero. I have the feeling that I'm not understanding something about data relationships. Any idea why these fields are getting set to 0? In the final application users won't really create PracticeInstances manually (it will be part of creating a PracticeSession), but I'd like to be able to add fields for testing. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: general model association/SQL question: linking one table to many others
yes, I do so because I want to translate my phrases. I would use CakePHP to translate interface, but also want my actual data to be in several languages. Seems that creating additional table for each field is the only way to go =( Regards, Vadim. On 15 April 2010 04:44, cricket zijn.digi...@gmail.com wrote: This is a bit backwards but I think it would work. Car model: var $belongsTo = array( 'CarName' = array( 'className' = 'Phrase', 'foreignKey' = 'name_id' ), 'CarDescription' = array( 'className' = 'Phrase', 'foreignKey' = 'description_id' ) ); The scenario you describe seems a little messy though. Maybe there's a better approach. Does this concern translations? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject.
Re: Cake won't save my data
Your conventions look a bit skewed, which is why you are getting odd results. The link should refer to the controller name, which is lower case, plural with underscores (practice_items). http://book.cakephp.org/view/901/CakePHP-Conventions Jeremy Burns jeremybu...@me.com On 14 Apr 2010, at 22:48, Johnny Ferguson wrote: Thanks Alan, my table is definitely being populated now. I've fixed up the controller names to follow the convention. On my PracticeItems/index view I have created a link to the add form like so: echo $html-link('add new item', array('controller' = 'PracticeItems', 'action' = 'add')); When I arrive at the page, the url is /cakeRoot/PracticeItems/add When the form submits, the url changes to /cakeRoot/practice_items/add Why won't $html-link put the url in the conventional format? (practice_items) Would it make more sense to say echo $html-link('add new item', array('controller' = 'practice_items', 'action' = 'add')); in order to keep with convention? Furthermore, when I enable the redirect in practice_items_controller.php, I get an error when the redirect executes. The redirect line is as follows: $this-redirect(array('action' = 'index')); which should take me to /cakeRoot/PracticeItems/index, but instead I get the error: Warning (2): Cannot modify header information - headers already sent by (output started at /var/www/go/htdocs/practicelog/cake/basics.php: 306) [CORE/cake/libs/controller/controller.php, line 644] EDIT: I fixed this issue by disabling the line that said $this-set('debug', pr($this-data)); It would seem sending data to the view makes a redirect impossible. I've included this in case anyone has a similar issue in the future. On 14 Apr, 17:17, Alan Asher a...@asteriskpound.com wrote: In your practice_items_controller.php your pr should not have the lowercase and underscored array element. Check your form or wherever you're assigning this array and your pr should look like Array ( [PracticeItem] = Array ( [name] = Test [description] = Test ) ) PracticeItem is the Model Name This is part of the whole convention over configuration. Alan -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Johnny Ferguson Sent: Wednesday, April 14, 2010 2:10 PM To: CakePHP Subject: Re: Cake won't save my data I've checked with the folks in the IRC, and it looks like Cake shouldn't care if I'm using InnoDB, but my data still won't show up in the tables regardless of Cake giving me every indication that the save was successful. On 14 Apr, 16:43, Johnny Ferguson hyperfle...@gmail.com wrote: I'm using InnoDB to allow data associations. Do I have to note this fact in my database.php? Other than that, I'm at a loss as to why this problem is occurring. My practice_items table: int - id varchar(255) - name text - description /app/controllers/practice_items_controller.php:http://pastebin.com/K3uu38fw /app/views/practice_items/add.ctp:http://pastebin.com/dfxrnhhT the pr() statement successfully puts out the data I post through the form when using the add() method. I get this as a result of pr(): Array ( [practice_items] = Array ( [name] = Test [description] = Test ) ) As I understand it, since id is auto-increment, I shouldn't need to explicitly pass that through the form. Cake gives me every indication that the save method worked, so I'm at a loss as to why the data isn't showing up in my practice_items table. I would think at the very least that cake would spit back a MySQL error if something were wrong. Here's my controller dump:http://pastebin.com/KHiZt8J8 Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email
Re: getting a 3rd-hand database value without recursive = 2
Two options... Use $this-Service-find(); instead Or... I would use the Containable behaviour - this seems like such a recurring piece of advice from me - but it really does solve a heap of issues! If you don't use contain, you are more or less letting Cake decide what data to bring back - and I have worked on a few second hand systems where a single, simple, find statement has brought back almost the entire database - seriously. Imagine what that does to performance... Create app_model.php and store it in the same folder as app_controller.php. class AppModel extends Model { var $actsAs = array('Containable'); var $recursive = -1; } Now, you have switched off recursion across the system, so by default a find will only bring back the 'current' model's table (in other words, no associated data). This might mean you have to revisit some existing queries. But the benefit is that you can now do really finds. In your case: $this-Service-find( 'all', array( 'conditions' = array('Service.id' = $id), 'fields' = array(..field list...), 'Contain' = array( 'Credential' = 'fields' = array(...field list...), array( 'CredentialType' = array( 'fields' = array(...field list...) ) ) ) ) ); You could also just put the containable behaviour inside your Service model, but I don't see the point of doing something so beneficial on just a portion of your app. Jeremy Burns jeremybu...@me.com On 14 Apr 2010, at 22:01, Joshua Taylor wrote: Situation: Viewing a service. A service has credentials. Credentials have a credential type. I'm using $service = $this-Service-findById($id); to set all the data for my view. I have all the database associations set up correctly (I think): Service hasMany Credential. Credential belongsTo Service, CredentialType. CredentialType hasMany Credential. How can I get it to retrieve CredentialType.title, so I can display the title instead of the Credential.credential_type_id value, which is worthless to a person viewing the service? I really don't want to use recursive = 2 (although it works), because it creates enormous database overhead! (55 queries vs. 25) Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using remove me as the subject. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en