Re: Find all Posts WITHOUT Tags (habtm)
On 5/24/2010 5:55 PM, designv...@gmail.com wrote: Hi All, I'm currently finding all Posts without Tags by querying the join table and getting the unique Post id's then using them in a second query on the Posts table to find all Posts with an id NOT in the first array. What I was wondering is if there was a neater/caker way of doing this? Stumbled upon the same thing, here's my solution... cake friendly. Project HABTM Invoice $projects = $this-Project-find('list', array( 'conditions' = array('InvoicesProject.invoice_id' = null), 'joins' = array( array('table' = 'invoices_projects', 'alias' = 'InvoicesProject', 'type' = 'left', 'conditions'= array('InvoicesProject.project_id = Project.id')) ) )); Using 1.3.0 btw. HTH 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
session related query
hai all I have facing the problem of session management because once I delete or destroy the session in logout page so it will redirect the index page and this process is correct but once I click the back button of the browser it open the welcome page with login the user and there the previous user name also be presented. So please tell me how I create the logout page and destroy the session. its urgent.. thanking you 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: Order problem with deep association
yes, that about does it.. but what if i want to order by two fields? something like: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do it like this foreach($shifts as $i = $shift) { $shifts[$i]['Assignment'] = Set::sort($data['Assignment'], '{n}.Person.name', 'asc'); } On Jun 2, 5:52 am, shantamg jason.galu...@gmail.com wrote: Shift hasMany Assignment Assignment belongsTo Person, Shift Person hasMany Assignment So if I do this: $this-Shift-find('all', array( 'contain' = 'Assignment.Person' )); I get something like this: Array ( [0] = Array ( [Shift] = Array ( [id] = 1 etc... [Assignment] = Array ( [0] = Array ( [id] = 1 [person_id] = 1 [shift_id] = 1 etc... [Person] = Array ( [id] = 1 [name] = Shantam etc... ) ) [1] = Array ( [id] = 2 [person_id] = 2 [shift_id] = 1 etc... [Person] = Array ( [id] = 2 [name] = Alix etc... ) ) etc ) ) ) So there's only ever one Person per Assignment. How can I order the Assignments by Person.name? Thanks, Jason Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
How to Add/Remove records dyanmically...
Hi i am new to cakephp, here i attached the screen shot off my application please see that attachment, any one having the related sample code please help me out. 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 attachment: Naru.png
displaying sql query
Hi all, Can someone help me with this. I do a query on my database from model. function getResult() { $result = $this-query(SELECT * FROM `downloads` WHERE `index`=123); } I call assign the query result to the view from controller. function index(){ $this-set('result', $this-MosDownload-getResult()); } I call the variable on the view. h2?php echo $result; ?/h2 But the result is not displayed. What is 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
auto refreshing page
Hi all, How should I go about creating a page in cakephp that can auto refresh by itself. basically, I want to fetch the latest data from the database. I don't want the whole page to refresh. Merely the latest number. Can someone give me some advise? /bryan 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: displaying sql query
You never return $result from the getResult function. You need: function getResult() { $result = $this-query(SELECT * FROM `downloads` WHERE `index`=123); return $result; } On Fri, Jun 4, 2010 at 10:40 AM, ytbryan ytbr...@gmail.com wrote: Hi all, Can someone help me with this. I do a query on my database from model. function getResult() { $result = $this-query(SELECT * FROM `downloads` WHERE `index`=123); } I call assign the query result to the view from controller. function index(){ $this-set('result', $this-MosDownload-getResult()); } I call the variable on the view. h2?php echo $result; ?/h2 But the result is not displayed. What is 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.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
Re: displaying sql query
try this function getResult() { $result = $this-query(SELECT * FROM `downloads` WHERE `index`=123); print_r($result); } On Fri, Jun 4, 2010 at 3:16 PM, Toby Ashley lowpi...@gmail.com wrote: You never return $result from the getResult function. You need: function getResult() { $result = $this-query(SELECT * FROM `downloads` WHERE `index`=123); return $result; } On Fri, Jun 4, 2010 at 10:40 AM, ytbryan ytbr...@gmail.com wrote: Hi all, Can someone help me with this. I do a query on my database from model. function getResult() { $result = $this-query(SELECT * FROM `downloads` WHERE `index`=123); } I call assign the query result to the view from controller. function index(){ $this-set('result', $this-MosDownload-getResult()); } I call the variable on the view. h2?php echo $result; ?/h2 But the result is not displayed. What is 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.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.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en -- Dilip Godhani Jr Software Developer, Entourage Solutions e-mail: di...@entouragesolutions.com dilip.godh...@gmail.com Web.: www.entouragesolutions.com m. 9913822582 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: auto refreshing page
Hi Bryan, I assume you want to build something like 'x' number of ipads sold. You can use the Javascript setinterval function to make an ajax call. This ajax call can update the div to show the latest number in your case. Thanks, Bharadwaj http://webhostingangel.com On 04-Jun-10, at 4:42 AM, ytbryan wrote: Hi all, How should I go about creating a page in cakephp that can auto refresh by itself. basically, I want to fetch the latest data from the database. I don't want the whole page to refresh. Merely the latest number. Can someone give me some advise? /bryan 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
Cake console shell
Hi all, When trying to run /path_to/cake/console/cake mail in shell I get the following error: Error: Class MailShell could not be loaded. Can anybody perhaps point me in the right direction why i get this error? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cake console shell
just type cake and you will see the available shells yours is not in that list i guess On 4 Jun., 12:20, Edwin edwink...@gmail.com wrote: Hi all, When trying to run /path_to/cake/console/cake mail in shell I get the following error: Error: Class MailShell could not be loaded. Can anybody perhaps point me in the right direction why i get this error? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cake console shell
Thanks, got it working! I forgot to add the -app parameter. Is there any parameter or way that i can dissable any output from the console? E.g. don't display the Welcome to CakePHP v1.3.0 Console etc. Thanks again On Jun 4, 12:38 pm, euromark dereurom...@googlemail.com wrote: just type cake and you will see the available shells yours is not in that list i guess On 4 Jun., 12:20, Edwin edwink...@gmail.com wrote: Hi all, When trying to run /path_to/cake/console/cake mail in shell I get the following error: Error: Class MailShell could not be loaded. Can anybody perhaps point me in the right direction why i get this error? 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
Message Model with Sender and Recipient from User-Table
Hi all, I've got a messages model with two fields called sender and recipient which I'd like to link to the users table. I tried: -- var $hasOne = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'User' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); -- ..which doesn't lead to anything, although it *looks* obvious! :) Any ideas? TIA, nils 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: Message Model with Sender and Recipient from User-Table
Try: var $hasOne = array( 'Sender' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'Recipient' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:17, nils wrote: Hi all, I've got a messages model with two fields called sender and recipient which I'd like to link to the users table. I tried: -- var $hasOne = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'User' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); -- ..which doesn't lead to anything, although it *looks* obvious! :) Any ideas? TIA, nils 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
Re: Cake console shell
why does it bother you? :) just ignore it On 4 Jun., 13:59, Edwin edwink...@gmail.com wrote: Thanks, got it working! I forgot to add the -app parameter. Is there any parameter or way that i can dissable any output from the console? E.g. don't display the Welcome to CakePHP v1.3.0 Console etc. Thanks again On Jun 4, 12:38 pm, euromark dereurom...@googlemail.com wrote: just type cake and you will see the available shells yours is not in that list i guess On 4 Jun., 12:20, Edwin edwink...@gmail.com wrote: Hi all, When trying to run /path_to/cake/console/cake mail in shell I get the following error: Error: Class MailShell could not be loaded. Can anybody perhaps point me in the right direction why i get this error? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Message Model with Sender and Recipient from User-Table
nah, doesn't work.. :/ 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: Message Model with Sender and Recipient from User-Table
Actually, looking at this a bit more, I'd like to pose a few questions. The general way of relating one table to another twice is that you give each a different class name - in your case Sender and Recipient. You then do a normal join, specifying the class name (User in your case) of the joining table and then specify the foreign key - what are they in your case? I guess the id column in the users table is User.id. What are the local keys in the messages table? Are thy Message.sender_id and Message.recipient_id? If so, the proper syntax would be: var $hasOne = array( 'Sender' = array( 'className' = 'User', 'foreignKey' = 'sender_id' ), 'Recipient' = array( 'className' = 'User', 'foreignKey' = 'recipient_id' ) ); See here for more details: http://book.cakephp.org/view/1046/Multiple-relations-to-the-same-model Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 4 Jun 2010, at 14:18, Jeremy Burns wrote: Try: var $hasOne = array( 'Sender' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'Recipient' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:17, nils wrote: Hi all, I've got a messages model with two fields called sender and recipient which I'd like to link to the users table. I tried: -- var $hasOne = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'User' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); -- ..which doesn't lead to anything, although it *looks* obvious! :) Any ideas? TIA, nils 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 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 console shell
PS: you would need to override startup() in all shell scripts - even the core ones... On 4 Jun., 15:27, euromark dereurom...@googlemail.com wrote: why does it bother you? :) just ignore it On 4 Jun., 13:59, Edwin edwink...@gmail.com wrote: Thanks, got it working! I forgot to add the -app parameter. Is there any parameter or way that i can dissable any output from the console? E.g. don't display the Welcome to CakePHP v1.3.0 Console etc. Thanks again On Jun 4, 12:38 pm, euromark dereurom...@googlemail.com wrote: just type cake and you will see the available shells yours is not in that list i guess On 4 Jun., 12:20, Edwin edwink...@gmail.com wrote: Hi all, When trying to run /path_to/cake/console/cake mail in shell I get the following error: Error: Class MailShell could not be loaded. Can anybody perhaps point me in the right direction why i get this error? 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
Query Results, Empty Array
I've searched the group a bit and haven't found anything that seems to exactly solve my problem. Let me begin with the basics: This is a website which I am transitioning from an old ASP site into CakePHP. The site is driven by an MS-SQL database and being served from a Macintosh XServer running Apache2. So I am building Models based on the current database table structure and working from there. All of the connections seem to be working fine - queries are working perfectly - with the exception of my current problem. The problem is that in some cases, queries seem to work fine but the resulting array ends up being empty. There's nothing fancy about the query function itself: public function getPage($id) { $page = $this-find('first', array('conditions' = array('pageid' = $id, 'Page.default_levelid = Page.levelid'), 'recursive' = 3 )); return $page; } And the resulting ['Page'] array is fine. The problem is the next associated Model, the PageChart model. Here is where I associate it to Page: var $hasMany= array('PageChart' = array('foreignKey' = 'pageid', 'order'= 'line ASC')); In the CakePHP query table from the debug mode shows a proper query returning 6 PageChart results. However, in the returned array, the ['PageChart'] sub-array is completely empty. There are currently no associated Models for the PageChart model - I've removed them in order to limit the scope of the problem. I stress again that this is only a problem with certain queries for certain pages, not others. I am sure that, under the circumstances, there must be something about the data that is causing an issue. Otherwise, I would expect that the result would be either consistently right or consistently wrong, but not a bit of Column A and a bit of Column B. What I'm hoping someone can shed some light on is why CakePHP might bork on data but not give an error message. Character encoding problems? Spaces? Something like that? I really appreciate the help. 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: Message Model with Sender and Recipient from User-Table
Jeremy, thanks for the link, it was a bit buried in the depths of The Book, so I didn't find it at first. Will check there now.. - Initial test wasn't working, but I'll be getting there (I hope)! ;) cheers! nils On 4 Jun., 15:28, Jeremy Burns jeremybu...@me.com wrote: Actually, looking at this a bit more, I'd like to pose a few questions. The general way of relating one table to another twice is that you give each a different class name - in your case Sender and Recipient. You then do a normal join, specifying the class name (User in your case) of the joining table and then specify the foreign key - what are they in your case? I guess the id column in the users table is User.id. What are the local keys in the messages table? Are thy Message.sender_id and Message.recipient_id? If so, the proper syntax would be: var $hasOne = array( 'Sender' = array( 'className' = 'User', 'foreignKey' = 'sender_id' ), 'Recipient' = array( 'className' = 'User', 'foreignKey' = 'recipient_id' ) ); See here for more details:http://book.cakephp.org/view/1046/Multiple-relations-to-the-same-model Jeremy Burns jeremybu...@me.com (Skype) +44 208 123 3822 (jeremy_burns) (m) +44 7973 481949 (h) +44 208 530 7573 On 4 Jun 2010, at 14:18, Jeremy Burns wrote: Try: var $hasOne = array( 'Sender' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'Recipient' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:17, nils wrote: Hi all, I've got a messages model with two fields called sender and recipient which I'd like to link to the users table. I tried: -- var $hasOne = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'sender', 'conditions' = 'User.id = Message.sender', 'fields' = '', 'order' = '' ), 'User' = array( 'className' = 'User', 'foreignKey' = 'recipient', 'conditions' = 'User.id = Message.recipient', 'fields' = '', 'order' = '' ) ); -- ..which doesn't lead to anything, although it *looks* obvious! :) Any ideas? TIA, nils Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Query Results, Empty Array
Hmmm. So you say that Cake is creating a SQL query that works, but the array that collects the results has empty elements where you would expect data? Here's a couple of suggestions. Remove recursive completely - not ideal for production, but a good check to see if it is somehow limiting it. Then, immediately after you run the query ($page = $this-find) try this: die(debug($page)); What does that show? Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:39, DragonFlyEye wrote: I've searched the group a bit and haven't found anything that seems to exactly solve my problem. Let me begin with the basics: This is a website which I am transitioning from an old ASP site into CakePHP. The site is driven by an MS-SQL database and being served from a Macintosh XServer running Apache2. So I am building Models based on the current database table structure and working from there. All of the connections seem to be working fine - queries are working perfectly - with the exception of my current problem. The problem is that in some cases, queries seem to work fine but the resulting array ends up being empty. There's nothing fancy about the query function itself: public function getPage($id) { $page = $this-find('first', array('conditions' = array('pageid' = $id, 'Page.default_levelid = Page.levelid'), 'recursive' = 3 )); return $page; } And the resulting ['Page'] array is fine. The problem is the next associated Model, the PageChart model. Here is where I associate it to Page: var $hasMany = array('PageChart' = array('foreignKey' = 'pageid', 'order'= 'line ASC')); In the CakePHP query table from the debug mode shows a proper query returning 6 PageChart results. However, in the returned array, the ['PageChart'] sub-array is completely empty. There are currently no associated Models for the PageChart model - I've removed them in order to limit the scope of the problem. I stress again that this is only a problem with certain queries for certain pages, not others. I am sure that, under the circumstances, there must be something about the data that is causing an issue. Otherwise, I would expect that the result would be either consistently right or consistently wrong, but not a bit of Column A and a bit of Column B. What I'm hoping someone can shed some light on is why CakePHP might bork on data but not give an error message. Character encoding problems? Spaces? Something like that? I really appreciate the help. 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
Removal of post
Hello, Per terms and conditions of Google groups please remove all postings related to me. My email is jwadhw...@gmail.com Thanks Jayesh Wadhwani 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
solve the problem in cakephp
when I want to see users/index page I can see the list and everything is normal but it's not display in blue color box in first four row. but if I want to see users/add page the server says the requested address was not found on this server . 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
Keine Daten in $this-data
Hallo, ich habe ein großes Problem mit meinem Formular. Ich bekomme die Daten des Formulars in $this-params['form'] übergeben und nicht in $this- data. Hier der Code: print $form-create(Checkout, array( url = array(controller = checkout, action = step2), type = post)); print $form-input (select, array( options = array(Herr = Herr, Frau = Frau), label = Anrede:, name = anrede, id = anrede ) ); print $form-input (input, array ( label = Name:, name = name, id = name ) ); print $form-input (input, array ( label = Vorname:, name = vorname, id = vorname ) ); print $form-input (input, array ( label = Straszlig;e, Nr:, name = strasse, id = strasse ) ); print $form-input (input, array ( label = Postleitzahl:, name = plz, id = plz ) ); print $form-input (input, array ( label = Email:, name = email, id = email ) ); print $form-input (input, array ( label = Telefon:, name = telefon, id = telefon ) ); print $form-end(buttons/weiter.png); 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
No form data
hi, i have a little bit trouble because i don't get any form data in $this- data. i only get the data in $this-params['form']. is there a way to change that? that my form: print $form-create(Checkout, array( url = array(controller = checkout, action = step2), type = post)); print $form-input (select, array( options = array(Herr = Herr, Frau = Frau), label = Anrede:, name = anrede, id = anrede ) ); print $form-input (input, array ( label = Name:, name = name, id = name ) ); print $form-input (input, array ( label = Vorname:, name = vorname, id = vorname ) ); print $form-input (input, array ( label = Straszlig;e, Nr:, name = strasse, id = strasse ) ); print $form-input (input, array ( label = Postleitzahl:, name = plz, id = plz ) ); print $form-input (input, array ( label = Email:, name = email, id = email ) ); print $form-input (input, array ( label = Telefon:, name = telefon, id = telefon ) ); print $form-end(buttons/weiter.png); 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: Removal of post
All post directly from you have been removed per your request. If you have any further questions please direct them to google. http://groups.google.com/support/bin/answer.py?hl=enanswer=46452 -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ On Fri, Jun 4, 2010 at 5:04 AM, Jayesh Wadhwani jwadhw...@gmail.com wrote: Hello, Per terms and conditions of Google groups please remove all postings related to me. My email is jwadhw...@gmail.com Thanks Jayesh Wadhwani 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
Validate data md5
Hi, I have a form to add a user and I use an md5 encryption when I save the password in the database. I use $validate to check if the email address is valid. If it's not, the form shows the data again with the error message but the password is not the right one in this case. It's the hashed password. So when I re-enter a valid email address, the password that is saved in the database is not the one I wanted! How can I do ? Thank you in advance! 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: Redirecting from javascript
Are you asking how to redirect to a different page in JavaScript? That's not really Cake-related, but it's window.location = 'your new page'. On Jun 3, 9:49 pm, [-Cheluis-] tangu...@gmail.com wrote: Hi! I was wondering if there is a way to redirect from one action to another via javascript. I want to do some validations and then, redirect the flow to one specific action. Any ideas? thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Cake console shell
Because I'm using it for email piping. When I'm running the shell it will reply the email with the CakePHP Console message. Will give the overriding startups a try.. but there must be a better solution? Thanks! On Jun 4, 3:27 pm, euromark dereurom...@googlemail.com wrote: why does it bother you? :) just ignore it On 4 Jun., 13:59, Edwin edwink...@gmail.com wrote: Thanks, got it working! I forgot to add the -app parameter. Is there any parameter or way that i can dissable any output from the console? E.g. don't display the Welcome to CakePHP v1.3.0 Console etc. Thanks again On Jun 4, 12:38 pm, euromark dereurom...@googlemail.com wrote: just type cake and you will see the available shells yours is not in that list i guess On 4 Jun., 12:20, Edwin edwink...@gmail.com wrote: Hi all, When trying to run /path_to/cake/console/cake mail in shell I get the following error: Error: Class MailShell could not be loaded. Can anybody perhaps point me in the right direction why i get this error? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: session related query
That's a browser caching problem. You can use the pragma, cache- control, and expires headers: http://book.cakephp.org/view/350/Obtaining-Request-Information If you use all 3, then that should prevent most standards-compliant browsers (and IE5 and later) from caching the page. On Jun 4, 12:26 am, vikasphplernter chipheardwe...@gmail.com wrote: hai all I have facing the problem of session management because once I delete or destroy the session in logout page so it will redirect the index page and this process is correct but once I click the back button of the browser it open the welcome page with login the user and there the previous user name also be presented. So please tell me how I create the logout page and destroy the session. its urgent.. thanking you 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: How to Add/Remove records dyanmically...
Is sample code a euphemism for please write the code for me for free? Unless this is an open source project (in which case, please provide a link to the public repository where the codebase is located), don't expect others to do your work for you. If you're not going to try and solve a simple problem (and it _is_ simple for anyone who reads the Cookbook) on your own by reading the Cake manual, then why should anyone help you? On Jun 4, 2:37 am, Narendra Padala crazycake...@gmail.com wrote: Hi i am new to cakephp, here i attached the screen shot off my application please see that attachment, any one having the related sample code please help me out. Naru.png 30KViewDownload 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: No form data
Please take your time to read the CakePHP manual at: http://book.cakephp.org/view/1390/Automagic-Form-Elements so that you understand how to use the Form helper input method! There is clearly stated that the Form helper input method expects the following parameters: input(string $fieldName, array $options = array()) Change your code to conform to this and your data will be placed in the correct array. Enjoy, John On Jun 4, 4:47 pm, Christoph christophwe...@googlemail.com wrote: hi, i have a little bit trouble because i don't get any form data in $this-data. i only get the data in $this-params['form']. is there a way to change that? that my form: print $form-create(Checkout, array( url = array(controller = checkout, action = step2), type = post)); print $form-input (select, array ( options = array(Herr = Herr, Frau = Frau), label = Anrede:, name = anrede, id = anrede ) ); print $form-input (input, array ( label = Name:, name = name, id = name ) ); print $form-input (input, array ( label = Vorname:, name = vorname, id = vorname ) ); print $form-input (input, array ( label = Straszlig;e, Nr:, name = strasse, id = strasse ) ); print $form-input (input, array ( label = Postleitzahl:, name = plz, id = plz ) ); print $form-input (input, array ( label = Email:, name = email, id = email ) ); print $form-input (input, array ( label = Telefon:, name = telefon, id = telefon ) ); print $form-end(buttons/weiter.png); 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: Query Results, Empty Array
^I'm pretty sure that debug() doesn't have a return value. So I usually just call debug($page);die;. DragonFlyEye: How many queries are in the query table? Are you sure you're looking at the right one? Is there some kind of command-line client for MS-SQL that you can use to see exactly what each query returns? And you have pretty non-standard field names (and probably table names as well). Did you use Cake Bake to generate all of your models or make sure that the models are all defined properly? On Jun 4, 6:46 am, Jeremy Burns jeremybu...@me.com wrote: Hmmm. So you say that Cake is creating a SQL query that works, but the array that collects the results has empty elements where you would expect data? Here's a couple of suggestions. Remove recursive completely - not ideal for production, but a good check to see if it is somehow limiting it. Then, immediately after you run the query ($page = $this-find) try this: die(debug($page)); What does that show? Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:39, DragonFlyEye wrote: I've searched the group a bit and haven't found anything that seems to exactly solve my problem. Let me begin with the basics: This is a website which I am transitioning from an old ASP site into CakePHP. The site is driven by an MS-SQL database and being served from a Macintosh XServer running Apache2. So I am building Models based on the current database table structure and working from there. All of the connections seem to be working fine - queries are working perfectly - with the exception of my current problem. The problem is that in some cases, queries seem to work fine but the resulting array ends up being empty. There's nothing fancy about the query function itself: public function getPage($id) { $page = $this-find('first', array('conditions' = array('pageid' = $id, 'Page.default_levelid = Page.levelid'), 'recursive' = 3 )); return $page; } And the resulting ['Page'] array is fine. The problem is the next associated Model, the PageChart model. Here is where I associate it to Page: var $hasMany = array('PageChart' = array('foreignKey' = 'pageid', 'order' = 'line ASC')); In the CakePHP query table from the debug mode shows a proper query returning 6 PageChart results. However, in the returned array, the ['PageChart'] sub-array is completely empty. There are currently no associated Models for the PageChart model - I've removed them in order to limit the scope of the problem. I stress again that this is only a problem with certain queries for certain pages, not others. I am sure that, under the circumstances, there must be something about the data that is causing an issue. Otherwise, I would expect that the result would be either consistently right or consistently wrong, but not a bit of Column A and a bit of Column B. What I'm hoping someone can shed some light on is why CakePHP might bork on data but not give an error message. Character encoding problems? Spaces? Something like that? I really appreciate the help. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: No form data
1. Controllers are plural. So it would be 'checkouts' not 'checkout'. 2. Read the Cookbook; you're not using $form-input() correctly. On Jun 4, 6:47 am, Christoph christophwe...@googlemail.com wrote: hi, i have a little bit trouble because i don't get any form data in $this-data. i only get the data in $this-params['form']. is there a way to change that? that my form: print $form-create(Checkout, array( url = array(controller = checkout, action = step2), type = post)); print $form-input (select, array ( options = array(Herr = Herr, Frau = Frau), label = Anrede:, name = anrede, id = anrede ) ); print $form-input (input, array ( label = Name:, name = name, id = name ) ); print $form-input (input, array ( label = Vorname:, name = vorname, id = vorname ) ); print $form-input (input, array ( label = Straszlig;e, Nr:, name = strasse, id = strasse ) ); print $form-input (input, array ( label = Postleitzahl:, name = plz, id = plz ) ); print $form-input (input, array ( label = Email:, name = email, id = email ) ); print $form-input (input, array ( label = Telefon:, name = telefon, id = telefon ) ); print $form-end(buttons/weiter.png); 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: Query Results, Empty Array
@calvin: Not sure I understand you. die(debug($page)); will return the contents of $page and then stop the code. Works every time. Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 16:24, calvin wrote: ^I'm pretty sure that debug() doesn't have a return value. So I usually just call debug($page);die;. DragonFlyEye: How many queries are in the query table? Are you sure you're looking at the right one? Is there some kind of command-line client for MS-SQL that you can use to see exactly what each query returns? And you have pretty non-standard field names (and probably table names as well). Did you use Cake Bake to generate all of your models or make sure that the models are all defined properly? On Jun 4, 6:46 am, Jeremy Burns jeremybu...@me.com wrote: Hmmm. So you say that Cake is creating a SQL query that works, but the array that collects the results has empty elements where you would expect data? Here's a couple of suggestions. Remove recursive completely - not ideal for production, but a good check to see if it is somehow limiting it. Then, immediately after you run the query ($page = $this-find) try this: die(debug($page)); What does that show? Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:39, DragonFlyEye wrote: I've searched the group a bit and haven't found anything that seems to exactly solve my problem. Let me begin with the basics: This is a website which I am transitioning from an old ASP site into CakePHP. The site is driven by an MS-SQL database and being served from a Macintosh XServer running Apache2. So I am building Models based on the current database table structure and working from there. All of the connections seem to be working fine - queries are working perfectly - with the exception of my current problem. The problem is that in some cases, queries seem to work fine but the resulting array ends up being empty. There's nothing fancy about the query function itself: public function getPage($id) { $page = $this-find('first', array('conditions' = array('pageid' = $id, 'Page.default_levelid = Page.levelid'), 'recursive' = 3 )); return $page; } And the resulting ['Page'] array is fine. The problem is the next associated Model, the PageChart model. Here is where I associate it to Page: var $hasMany = array('PageChart' = array('foreignKey'= 'pageid', 'order' = 'line ASC')); In the CakePHP query table from the debug mode shows a proper query returning 6 PageChart results. However, in the returned array, the ['PageChart'] sub-array is completely empty. There are currently no associated Models for the PageChart model - I've removed them in order to limit the scope of the problem. I stress again that this is only a problem with certain queries for certain pages, not others. I am sure that, under the circumstances, there must be something about the data that is causing an issue. Otherwise, I would expect that the result would be either consistently right or consistently wrong, but not a bit of Column A and a bit of Column B. What I'm hoping someone can shed some light on is why CakePHP might bork on data but not give an error message. Character encoding problems? Spaces? Something like that? I really appreciate the help. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en 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: Cookie name problem
What do you mean the cookie stops working? Are you not able to store new cookie data or just forgetting the old data stored before changing the cookie name? If it's the latter, that's normal. If you were saving information in $_COOKIE['cakephp'] before, and then you tell CakePHP to get that information from $_COOKIE['goodprg'], then naturally it won't find the old information. That is the expected behavior. On Jun 3, 4:50 am, FandaR fandarem...@gmail.com wrote: Hi, I have problem with cookies. If I rename the cookie to some name, for example I set Configure::write('Session.cookie', 'goodprg'); in core.php config file, The cookies stops working. I have setup Configure::write('Session.save', 'cake'); If I setup the cookies back to original name - Configure::write('Session.cookie', 'cakephp'); Then its working good. What can be 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
Re: Updating One-to-Many Relations
I think the exception is when you have a many-to-many relationship and the 'unique' property is set (by default). Then it will delete all of the associated records in the join table before performing the add operations. On Jun 3, 7:21 am, John Andersen j.andersen...@gmail.com wrote: The saveAll only saves the information that is available, it does not remove information not available, so when you uncheck a Day, that information is not available and saveAll does nothing with it! You have to think differently in order to remove an existing Day :) Enjoy, John On Jun 3, 4:18 pm, bowikaxu bowik...@gmail.com wrote: Hi, i have a problem with a one to many relations, my models look like this: Calendar ( hasMany Days ) Day ( belongsTo Calendar ) The add operation is ok, i select some days from a calendar and they get inserted and related to its calendar. But when i edit a calendar the view previously selects the days it has, but if i remove one day and select another one and i do a saveAll operation the Days related to the Calendar remains the same, what could be wrong? Thanks in advance to all responses. 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: How do I save a field on my User without breaking the ACL?
i have the same problem :( any idea?? On May 24, 9:25 pm, Jon Chin port23u...@gmail.com wrote: I tried that and have the same result. Do I need to unbind a relationship or something? On Mon, May 24, 2010 at 2:06 PM, Filipe Teles Rodrigues filipe.t2...@gmail.com wrote: I use $this-User-save($this-data) instead of saveField. 2010/5/24 Jon Chin port23u...@gmail.com I'm using Auth and db ACL, but I have an action that screws up my ACL records every time. I have ACL set up just like the Book instructs. I'm building a change password page where I want to just update the password. I run the following commands: $this-User-id = $this-Session-read('Auth.User.id'); $this-User-saveField('password', $this-data['User']['password']); (I've also tried $this-User-save()). When I execute this, it deletes the user's parent_id from the aros table as well as corrupts the tree-ness of the ACL tables. What am I doing wrong? Thanks in advance. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
DHMLX
Hello! Personal'm starting with cake and had a question. I use DHTMLX to create windows and layouts, but they do not know how to use it in cake we need a helper? or just call in the index? Sincerely, André Alexsandro Brazil / Joinville-SC (55) (47) 8825-0133 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: CakePHP development firm
LOL, the CakePHP community is a developers community. If you ask us for recommendations, (aside from CakeDC, as gmansilla mentioned) people are going to recommend that you go with them or their own firm. This isn't like the Magento community, where a lot of the members are end-users rather than developers (though most of the community edition users are still generally developers). CakePHP is pretty easy to work with, so unless you have a highly complex project, any company which has a few CakePHP CRUD sites in their portfolio will do. I'd be more focused on cost, overall web development experience, design ability, and (if it matters to you) whether they are local (if you live in a big city like LA, NYC, Chicago, etc.). And is there a reason why you're looking specifically at Cake? I mean, if I were going to contract someone to develop a web site/app for me, I wouldn't care which framework they used. I would find the best designer/developer in general, and let them choose which framework they want to develop the site with. On Jun 2, 1:30 pm, NS newstartuph...@gmail.com wrote: Is there a list of CakePHP development firms? We are looking to engage with one for a project and would like to get recommendation from the community 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
Re: Query Results, Empty Array
Yes, it does the same thing, because PHP still evaluates debug($page). I'm just saying that debug() doesn't have a return value; it just prints out the variable dump directly. Usually when people call die(expression), it's because they want die() to print out {expression} as the termination message. Calling die(debug($var)) is sort of like calling die(echo($var)) or die(var_dump($var)). There's nothing wrong with it. It will still do what you want it to do. I just thought it was odd is all. On Jun 4, 8:28 am, Jeremy Burns jeremybu...@me.com wrote: @calvin: Not sure I understand you. die(debug($page)); will return the contents of $page and then stop the code. Works every time. Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 16:24, calvin wrote: ^I'm pretty sure that debug() doesn't have a return value. So I usually just call debug($page);die;. DragonFlyEye: How many queries are in the query table? Are you sure you're looking at the right one? Is there some kind of command-line client for MS-SQL that you can use to see exactly what each query returns? And you have pretty non-standard field names (and probably table names as well). Did you use Cake Bake to generate all of your models or make sure that the models are all defined properly? On Jun 4, 6:46 am, Jeremy Burns jeremybu...@me.com wrote: Hmmm. So you say that Cake is creating a SQL query that works, but the array that collects the results has empty elements where you would expect data? Here's a couple of suggestions. Remove recursive completely - not ideal for production, but a good check to see if it is somehow limiting it. Then, immediately after you run the query ($page = $this-find) try this: die(debug($page)); What does that show? Jeremy Burns jeremybu...@me.com On 4 Jun 2010, at 14:39, DragonFlyEye wrote: I've searched the group a bit and haven't found anything that seems to exactly solve my problem. Let me begin with the basics: This is a website which I am transitioning from an old ASP site into CakePHP. The site is driven by an MS-SQL database and being served from a Macintosh XServer running Apache2. So I am building Models based on the current database table structure and working from there. All of the connections seem to be working fine - queries are working perfectly - with the exception of my current problem. The problem is that in some cases, queries seem to work fine but the resulting array ends up being empty. There's nothing fancy about the query function itself: public function getPage($id) { $page = $this-find('first', array('conditions' = array('pageid' = $id, 'Page.default_levelid = Page.levelid'), 'recursive' = 3 )); return $page; } And the resulting ['Page'] array is fine. The problem is the next associated Model, the PageChart model. Here is where I associate it to Page: var $hasMany = array('PageChart' = array('foreignKey' = 'pageid', 'order' = 'line ASC')); In the CakePHP query table from the debug mode shows a proper query returning 6 PageChart results. However, in the returned array, the ['PageChart'] sub-array is completely empty. There are currently no associated Models for the PageChart model - I've removed them in order to limit the scope of the problem. I stress again that this is only a problem with certain queries for certain pages, not others. I am sure that, under the circumstances, there must be something about the data that is causing an issue. Otherwise, I would expect that the result would be either consistently right or consistently wrong, but not a bit of Column A and a bit of Column B. What I'm hoping someone can shed some light on is why CakePHP might bork on data but not give an error message. Character encoding problems? Spaces? Something like that? I really appreciate the help. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit
Re: DHMLX
Who is they? The DHTMLX developers? A helper is just an object with a set of functions that save you time when creating your views (e.g. eliminate repetitive code, convenience functions, etc.). You might want to write a helper for DHTMLX, but it's not necessary. You probably want to start off by just ignoring the AJAX stuff and build a regular site using Cake. Then once you figure out how Cake works, it should be simple to add the AJAX handlers. If you've already read the Cookbook and followed the tutorial, then it should be pretty straightforward how to use any JavaScript UI library with cake. Cake doesn't care how you style your tables or form inputs, and DHTMLX doesn't care what backend code you have. So just read the Cake and DHTMLX manuals and use DHTMLX as you would on any other site. On Jun 4, 8:43 am, Alexsandro miojoa...@gmail.com wrote: Hello! Personal'm starting with cake and had a question. I use DHTMLX to create windows and layouts, but they do not know how to use it in cake we need a helper? or just call in the index? Sincerely, André Alexsandro Brazil / Joinville-SC (55) (47) 8825-0133 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
Saving multiple rows of key-value pairs during a single update?
Well my last question here turned out to be between keyboard and chair, so hopefully this isn't quite as silly a question! I am learning Cake and building a custom user authentication system (who isn't?). I am trying to use two separate tables to store data, the User Model table as parent which stores only mission critical data (login, password, email, created, etc), and a MetaUser model table which is built around key value pairs (meta_id, user_id, meta_key, meta_value). Upon registration I have two pieces of meta information I would like to store - the activation code and an optin for receiving communication from site admins. I have built the forms as instructed by the Cake Book in order to use saveAll() in my Register action. The problem is that this results in the following array: Array ( [MetaUser] = Array ( [optin] = 1 [activation_code] = 9c1a26272907d4196a7bf39d [user_id] = 17 ) ) This obviously won't save since there is no optin or activation_code column in the MetaUser table. So I tried creating a beforeSave() under the presumption that if this was a numerical array it might try and add multiple rows on its own; public function beforeSave() { if ( isset( $this-data['MetaUser']['user_id'] ) ) { $userid = $this-data['MetaUser']['user_id']; $new = array(); $i = 0; foreach ( $this-data['MetaUser'] as $k = $v ) { $new[$i]['user_id']= $user_id; $new[$i]['meta_key'] = $k; $new[$i]['meta_value'] = $v; $i++; } $this-data['MetaUser'] = $new; } return true; } But apparently it doesn't work that way. I'm going to try it next using distinct save()'s for $this-User and $this-MetaUser but am I missing something else that I should be doing instead? I want to create a MetaUser model where I can save each entry (even if multiple are coming from one form) as separate rows based on the key = value pair setup. 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: Validate data md5
When you have an error on the registration form, it is a best practice to clear the password value and force the user to renter that info. So, in the controller... if($this-User-save($this-data)) { // ... whatever you do after user had registered successfully } else { // ... there was an error $this-data['User']['password'] = null; } V On Jun 4, 4:21 pm, Chrriss polet...@wanadoo.fr wrote: Hi, I have a form to add a user and I use an md5 encryption when I save the password in the database. I use $validate to check if the email address is valid. If it's not, the form shows the data again with the error message but the password is not the right one in this case. It's the hashed password. So when I re-enter a valid email address, the password that is saved in the database is not the one I wanted! How can I do ? Thank you in advance! 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: solve the problem in cakephp
On Jun 4, 6:23 am, asar asarudeen1...@gmail.com wrote: when I want to see users/index page I can see the list and everything is normal but it's not display in blue color box in first four row. but if I want to see users/add page the server says the requested address was not found on this server . Set debug to 2 in core.php. Cake throws a 404 error by default when it encounters an error and debug is 0. 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
Query question(s)
I was checking out the book on complex queries and not really finding what I'm looking for. I'm trying to create a query that covers both a basic and advanced search. The form may be submitting all or just some of the options available on the page depending on what the user chooses. Once the form has been submitted clicking any one of the query results would navigate the user away from the 'results page'. To avoid getting hit with the form submission dialogue when the users clicks the back button to return to the search results page and to cover the 'conditional query' ... I used to use a combo of $_GET and if(isset. ie: $query= SELECT something FROM somewhere WHERE etc. etc. etc. AND ; if (isset($_GET['some_value']) $_GET['some_value'] != '' ) { $value = $_GET['some_value']; $query .= AND something = '.addslashes($value).'; } And so on. I'm not familiar with using cache for anything. To avoid using get and the ugly urls would I be able to use post and cache the results also avoiding the form submission dialogue when returning to the results page? Also, what is the best approach to setting up a 'conditional' query similar to what I posted above? I'll spend some more time digging through the book and experimenting if someone can point me in the right direction. 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
Re: How do I save a field on my User without breaking the ACL?
Hi ! If you used the code given in the Simple Acl controlled application, it doesn't work out of the box if you save only one User's field. The parentNode() function check if the group_id field is not empty, and if it is, it returns null. This makes the Acl component think the User doesn't have any parent to store in the Aros. If you save only one field - without the goup_id field - you will have to reload the group_id value. I use the following code: function parentNode() { if (!$this-id empty($this-data)) { return null; } $data = $this-data; if (empty($this-data)) { $data = $this-read(); } elseif(isset($this-id) empty($data['User']['role_id'])) { /* * The role_id field was not intended to be saved, * but we need it in order to find the parent node in the Aros */ $data['User']['role_id'] = $this-field('role_id', array('User.id' = $this-id)); } if (empty($data['User']['role_id'])) { return null; } else { return array('Role' = array('id' = $data['User'] ['role_id'])); } } Just replace role_id by groupid or whatever name you used. Regards, nIcO On 4 juin, 17:53, stefano ssalvat...@gmail.com wrote: i have the same problem :( any idea?? On May 24, 9:25 pm, Jon Chin port23u...@gmail.com wrote: I tried that and have the same result. Do I need to unbind a relationship or something? On Mon, May 24, 2010 at 2:06 PM, Filipe Teles Rodrigues filipe.t2...@gmail.com wrote: I use $this-User-save($this-data) instead of saveField. 2010/5/24 Jon Chin port23u...@gmail.com I'm using Auth and db ACL, but I have an action that screws up my ACL records every time. I have ACL set up just like the Book instructs. I'm building a change password page where I want to just update the password. I run the following commands: $this-User-id = $this-Session-read('Auth.User.id'); $this-User-saveField('password', $this-data['User']['password']); (I've also tried $this-User-save()). When I execute this, it deletes the user's parent_id from the aros table as well as corrupts the tree-ness of the ACL tables. What am I doing wrong? Thanks in advance. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.c omFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Saving multiple rows of key-value pairs during a single update?
I think the easier way to accomplish this would be to adapt the view, like this: echo $this-Form-input('MetaUser.0.meta_key', array('type' = 'hidden', 'value' = 'activation_code')); echo $this-Form-input('MetaUser.0.meta_value', array('label' = 'Activation code')); On Jun 4, 6:48 pm, mwaterous m...@watero.us wrote: Well my last question here turned out to be between keyboard and chair, so hopefully this isn't quite as silly a question! I am learning Cake and building a custom user authentication system (who isn't?). I am trying to use two separate tables to store data, the User Model table as parent which stores only mission critical data (login, password, email, created, etc), and a MetaUser model table which is built around key value pairs (meta_id, user_id, meta_key, meta_value). Upon registration I have two pieces of meta information I would like to store - the activation code and an optin for receiving communication from site admins. I have built the forms as instructed by the Cake Book in order to use saveAll() in my Register action. The problem is that this results in the following array: Array ( [MetaUser] = Array ( [optin] = 1 [activation_code] = 9c1a26272907d4196a7bf39d [user_id] = 17 ) ) This obviously won't save since there is no optin or activation_code column in the MetaUser table. So I tried creating a beforeSave() under the presumption that if this was a numerical array it might try and add multiple rows on its own; public function beforeSave() { if ( isset( $this-data['MetaUser']['user_id'] ) ) { $userid = $this-data['MetaUser']['user_id']; $new = array(); $i = 0; foreach ( $this-data['MetaUser'] as $k = $v ) { $new[$i]['user_id'] = $user_id; $new[$i]['meta_key'] = $k; $new[$i]['meta_value'] = $v; $i++; } $this-data['MetaUser'] = $new; } return true; } But apparently it doesn't work that way. I'm going to try it next using distinct save()'s for $this-User and $this-MetaUser but am I missing something else that I should be doing instead? I want to create a MetaUser model where I can save each entry (even if multiple are coming from one form) as separate rows based on the key = value pair setup. 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: Order problem with deep association
Not really sure if it would work but you can try this $this-Shift-find('all', array( 'contain' = array( 'Assignment' = array( )); On Jun 4, 11:29 am, shantamg jason.galu...@gmail.com wrote: yes, that about does it.. but what if i want to order by two fields? something like: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do it like this foreach($shifts as $i = $shift) { $shifts[$i]['Assignment'] = Set::sort($data['Assignment'], '{n}.Person.name', 'asc'); } On Jun 2, 5:52 am, shantamg jason.galu...@gmail.com wrote: Shift hasMany Assignment Assignment belongsTo Person, Shift Person hasMany Assignment So if I do this: $this-Shift-find('all', array( 'contain' = 'Assignment.Person' )); I get something like this: Array ( [0] = Array ( [Shift] = Array ( [id] = 1 etc... [Assignment] = Array ( [0] = Array ( [id] = 1 [person_id] = 1 [shift_id] = 1 etc... [Person] = Array ( [id] = 1 [name] = Shantam etc... ) ) [1] = Array ( [id] = 2 [person_id] = 2 [shift_id] = 1 etc... [Person] = Array ( [id] = 2 [name] = Alix etc... ) ) etc ) ) ) So there's only ever one Person per Assignment. How can I order the Assignments by Person.name? Thanks, Jason 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: Order problem with deep association
Sorry about that, acidently posted before I finished :) $this-Shift-find('all', array( 'contain' = array( 'Assignment' = array( 'Person' = array( 'order' = 'Person.category_id ASC, Person.name ASC' ) ) ) )); On Jun 4, 11:29 am, shantamg jason.galu...@gmail.com wrote: yes, that about does it.. but what if i want to order by two fields? something like: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do it like this foreach($shifts as $i = $shift) { $shifts[$i]['Assignment'] = Set::sort($data['Assignment'], '{n}.Person.name', 'asc'); } On Jun 2, 5:52 am, shantamg jason.galu...@gmail.com wrote: Shift hasMany Assignment Assignment belongsTo Person, Shift Person hasMany Assignment So if I do this: $this-Shift-find('all', array( 'contain' = 'Assignment.Person' )); I get something like this: Array ( [0] = Array ( [Shift] = Array ( [id] = 1 etc... [Assignment] = Array ( [0] = Array ( [id] = 1 [person_id] = 1 [shift_id] = 1 etc... [Person] = Array ( [id] = 1 [name] = Shantam etc... ) ) [1] = Array ( [id] = 2 [person_id] = 2 [shift_id] = 1 etc... [Person] = Array ( [id] = 2 [name] = Alix etc... ) ) etc ) ) ) So there's only ever one Person per Assignment. How can I order the Assignments by Person.name? Thanks, Jason 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: Miles J Uploader help
Hey Miles or Anyone??, I feel like I found the problem with the uploader not accepting the birthdate array and before scrapping this uploader and moving to something different or changing the datetime field (I want to try and stick to cake's automagic form elements) I am going for one last attempt. I have logged many hours trying to figure this out and am still nowhere. I know that I keep getting an error because the birthdate is sending the info as an array to the component which is messing with the _parseData function starting on line 1006 or so in the uploader controller. So I thought I could change that data to a string to forgo the error. function afterFilter () { $birthdate = $this-data['UserPreference']['birthdate']['year'].'-'. $this-data['UserPreference']['birthdate']['month'].'-'.$this- data['UserPreference']['birthdate']['day']; $this-data['UserPreference']['birthdate'] = $birthdate; debug($this-data); } which when I debug I do get this [UserPreference] = Array ( [user_id] = 29 [image] = resume.jpg [sex] = Male [birthdate] = 2009-06-04 [hometown] = Los Angeles [introduction] = yo ) instead of this [UserPreference] = Array ( [user_id] = 29 [image] = resume.jpg [sex] = Male [birthdate] = Array ( [day] = 04 [month] = 06 [year] = 2009 ) [hometown] = Los Angeles [introduction] = yo ) which is what I got before which I believe is the culprit. But I am still getting the error. So - the question is (and I am almost certain I am using afterFilter wrong) - how do I pass this reformatted array to the uploader component rather than the latter array which seems to be stealing the info before anything I do? Thanks again, Brad On Jun 2, 4:49 pm, bradmaxs b...@pezzano.com wrote: Hey Miles, Did you ever test this? Just checking. I am going to try and maybe do a Set::extract?? Going to start tomorrow but thought I would check in. Brad On May 19, 11:37 am, Miles J mileswjohn...@gmail.com wrote: Its probably getting confused trying to load the data since both the file input and date input are arrays. I dont think I have ever tested with a date/time input, ill try it out. On May 19, 11:23 am,bradmaxsb...@pezzano.com wrote: Hey Miles, That worked for a straight upload action, thank you. The Model Attachment is still not working for me though, still getting the errors from the above post. After looking closer it seems that my birthdate field is doing something funny?? Warning (2): Invalid argument supplied for foreach() [APP/plugins/ uploader/controllers/components/uploader.php, line 1006] Code | Context if (is_array($data)) { foreach ($data as $model = $fields) { foreach ($fields as $field = $value) { $data = array( month = 05, day = 19, year = 2009 ) $fields = 05 $model = month I made it a hidden field and filled in the value myself and then just got this error - probably from the component? There was an error attaching this file! Any ideas? Thank you again for taking the time on this. Brad On May 18, 5:58 pm, Miles J mileswjohn...@gmail.com wrote: If you are using the latest uploader version, I believe its: if ($data = $this-Uploader-upload('UserPreference.fileName')) { On May 18, 11:14 am, Sam Sherlock sam.sherl...@gmail.com wrote: Hi Brad It is not a compatiblity issue with 1.3 - not able to speify the issue right now but will try to compare your code with mine later today but you may solve it by then :) - S On 18 May 2010 18:41,bradmaxsb...@pezzano.com wrote: I tried to just add it as an action in my controller and can't get a photo uploaded at all?? permissions are set to 777 on both my files folder and img_usericon as well. Here is the user_preferences_controller.php var $components = array('Uploader.Uploader'); in my beforeFilter $this-Uploader-uploadDir = 'files/img_usericon/'; $this-Auth-allow('upload'); the action function upload() { if (!empty($this-data)) { if ($data = $this-Uploader-upload('fileName')) { $this-Session-setFlash(sprintf(__('The %s has been saved', true), 'user photo')); $this-redirect(array('controller' = 'users', 'action' = 'profile', $this-Auth-user('id'))); } else { $this-Session-setFlash(sprintf(__('The %s could not saved', true), 'user photo'));
Re: Redirecting from javascript
How to redirect to another controller/function. From html you can do something like: ?php echo $html-link('Message', array('controller'='x','action'='y',$parm); ? How can I do this from js? window.location is enough? Thanks On Jun 4, 10:43 am, calvin cal...@rottenrecords.com wrote: Are you asking how to redirect to a different page in JavaScript? That's not really Cake-related, but it's window.location = 'your new page'. On Jun 3, 9:49 pm, [-Cheluis-] tangu...@gmail.com wrote: Hi! I was wondering if there is a way to redirect from one action to another via javascript. I want to do some validations and then, redirect the flow to one specific action. Any ideas? thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: How do I save a field on my User without breaking the ACL?
try with $this-data[User][group_id] = $this-Session- read(Auth.User.group_id); :) s. On May 24, 10:59 am, Jon Chin port23u...@gmail.com wrote: I'm using Auth and db ACL, but I have an action that screws up my ACL records every time. I have ACL set up just like the Book instructs. I'm building a change password page where I want to just update the password. I run the following commands: $this-User-id = $this-Session-read('Auth.User.id'); $this-User-saveField('password', $this-data['User']['password']); (I've also tried $this-User-save()). When I execute this, it deletes the user's parent_id from the aros table as well as corrupts the tree-ness of the ACL tables. What am I doing wrong? Thanks in advance. Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: email component - sending mail via smtp fails on own server!
I would suspect that or php/apche may need to be rebuilt to include mail On 6/3/10, euromark dereurom...@googlemail.com wrote: as i mentioned above, php mails via mail() are working both cake and pure php based using my good old phpmailer from the days before cake i get a similar error with $mail-SMTPAuth = true; and $mail-IsSMTP(); like this: SMTP - ERROR: Failed to connect to server: Invalid argument (22) SMTP Error: Could not connect to SMTP host. (bool)FALSE if i dont use $mail-IsSMTP(); the email gets successfully sent (via mail() - which of course works) it might actually be something connected to the smtp server... On 4 Jun., 00:01, Jonathon Musters luvz2...@gmail.com wrote: Try a simple test Using php only not cake. Try sending an email If it works cake issue if not server config Let us know Jonathon On 6/3/10, euromark dereurom...@googlemail.com wrote: i have quite a strange problem with the email component it never failed me before but on the new server i installed an own exim4 mail server with imap/ pop/smtp well, - sending mails wie mail() works, - sending mails via smtp from outside (like thunderbird email program) works - sending mails wie cake email component to myself (own domain) works as well but - sending mails to other providers (gmx, web, ...) always returns FALSE i debugged it and found out after getting 503, it does authenticate (line 816 ff): $authRequired = $this-_smtpSend('AUTH LOGIN', '334|503'); the next statement returns 250 (line 829 ff) - thats fine too: if (!$this-_smtpSend('MAIL FROM: ' . $this-_formatAddress($this- from, true))) { but the next one fails (if its a foreign domain) (line 839 ff): if (!$this-_smtpSend('RCPT TO: ' . $this-_formatAddress($to, true))) { it just returns an empty string (which of course results in return false) the foreign email addresses are valid and this is my exim4 error log: 2010-06-03 22:45:10 H=my.domain.de (www.domain.de) [83.xxx.xx.102] F=kont...@domain.de rejected RCPT n...@foreigndomain.de: relay not permitted 2010-06-03 22:45:10 unexpected disconnection while reading SMTP command from my.domain.de (www.domain.de) [83.xxx.xx.102] exim4 is on default - no modifications so far and - as i stated - its working if i connect via thunderbird mail program. so the smtp server might not be responsible. is it really the cake component which fails? version: cake1.3 head i am really clueless whats going on here, why smtp does not work. any ideas? that would save my day. thx 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 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 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: Order problem with deep association
yes, but now we're back to the same problem: we are sorting only the one person record inside of each assignment, and we want to sort the assignments. the programatic way you suggested works (i included what I did below), but unlike contain, Set::sort() only takes one sort parameter. if (isset($area['Shift'])) { foreach($area['Shift'] as $shift) { $shift['Assignment'] = Set::sort( $shift['Assignment'], {n}.Person.resident_category_id, asc ); } } On Jun 4, 1:04 pm, vekija vedran.konto...@gmail.com wrote: Sorry about that, acidently posted before I finished :) $this-Shift-find('all', array( 'contain' = array( 'Assignment' = array( 'Person' = array( 'order' = 'Person.category_id ASC, Person.name ASC' ) ) ) )); On Jun 4, 11:29 am, shantamg jason.galu...@gmail.com wrote: yes, that about does it.. but what if i want to order by two fields? something like: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do it like this foreach($shifts as $i = $shift) { $shifts[$i]['Assignment'] = Set::sort($data['Assignment'], '{n}.Person.name', 'asc'); } On Jun 2, 5:52 am, shantamg jason.galu...@gmail.com wrote: Shift hasMany Assignment Assignment belongsTo Person, Shift Person hasMany Assignment So if I do this: $this-Shift-find('all', array( 'contain' = 'Assignment.Person' )); I get something like this: Array ( [0] = Array ( [Shift] = Array ( [id] = 1 etc... [Assignment] = Array ( [0] = Array ( [id] = 1 [person_id] = 1 [shift_id] = 1 etc... [Person] = Array ( [id] = 1 [name] = Shantam etc... ) ) [1] = Array ( [id] = 2 [person_id] = 2 [shift_id] = 1 etc... [Person] = Array ( [id] = 2 [name] = Alix etc... ) ) etc ) ) ) So there's only ever one Person per Assignment. How can I order the Assignments by Person.name? Thanks, Jason 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: How do I save a field on my User without breaking the ACL?
The point is that Session is not defined in models. So if you do like this, you will have to do it each time you want to save a User without the group_id field, in each of your controller's actions. Doing it directly in the model allows you to care about the presence of the group_id field only once. But it is done through an extra SQL query to retrieve the group_id value. We could of course retrieve the group_id in the model by directly using the $_SESSION variable. By the way, I have always wondered if it was a design choice to not have access to the CakeSession object in the model. If anyone has the answer, I would be happy to read it. nIcO On 4 juin, 22:25, stefano ssalvat...@gmail.com wrote: try with $this-data[User][group_id] = $this-Session- read(Auth.User.group_id); :) s. On May 24, 10:59 am, Jon Chin port23u...@gmail.com wrote: I'm using Auth and db ACL, but I have an action that screws up my ACL records every time. I have ACL set up just like the Book instructs. I'm building a change password page where I want to just update the password. I run the following commands: $this-User-id = $this-Session-read('Auth.User.id'); $this-User-saveField('password', $this-data['User']['password']); (I've also tried $this-User-save()). When I execute this, it deletes the user's parent_id from the aros table as well as corrupts the tree-ness of the ACL tables. What am I doing wrong? Thanks in advance. Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions 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: Validate data md5
If you don't want to reenter the password, you can use a different name for the password input. For instance: View: $this-Form-input('new_password', array('type' = 'password')); Controller: if(!empty($this-data['User']['new_password'])) { $this-data['User']['password'] = $this-Auth-password($this- data['User']['new_password']); } This way if your form is printed again, the field new_password is not hashed. Regards, nIcO On 4 juin, 19:08, vekija vedran.konto...@gmail.com wrote: When you have an error on the registration form, it is a best practice to clear the password value and force the user to renter that info. So, in the controller... if($this-User-save($this-data)) { // ... whatever you do after user had registered successfully} else { // ... there was an error $this-data['User']['password'] = null; } V On Jun 4, 4:21 pm, Chrriss polet...@wanadoo.fr wrote: Hi, I have a form to add a user and I use an md5 encryption when I save the password in the database. I use $validate to check if the email address is valid. If it's not, the form shows the data again with the error message but the password is not the right one in this case. It's the hashed password. So when I re-enter a valid email address, the password that is saved in the database is not the one I wanted! How can I do ? Thank you in advance! 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: Order problem with deep association
Try this. The code is dirty so you should refactor it :) //sort assignments by person category $data['Assignment'] = Set::sort($data['Assignment'], '{n}.Person.category', 'ASC'); //group assignments by person category //person name is used here as a array key as I'm not sure how to make this with numeric keys :) $data['Assignment'] = Set::combine($data['Assignment'], '{n}.Person.name', '{n}', '{n}.Person.category'); $assignments = array(); foreach($data['Assignment'] as $i=$group) { // revert back tu numeric keys :) $data['Assignment'][$i] = array_values($group); // sort array by person name $data['Assignment'][$i] = Set::sort($data['Assignment'] [$i], '{n}.Person.name', 'ASC'); $assignments = array_merge($assignments, $data['Assignment'][$i]); } $data['Assignment'] = $assignments; Going to bed. Cheers On Jun 4, 11:36 pm, shantamg jason.galu...@gmail.com wrote: yes, but now we're back to the same problem: we are sorting only the one person record inside of each assignment, and we want to sort the assignments. the programatic way you suggested works (i included what I did below), but unlike contain, Set::sort() only takes one sort parameter. if (isset($area['Shift'])) { foreach($area['Shift'] as $shift) { $shift['Assignment'] = Set::sort( $shift['Assignment'], {n}.Person.resident_category_id, asc ); } } On Jun 4, 1:04 pm, vekija vedran.konto...@gmail.com wrote: Sorry about that, acidently posted before I finished :) $this-Shift-find('all', array( 'contain' = array( 'Assignment' = array( 'Person' = array( 'order' = 'Person.category_id ASC, Person.name ASC' ) ) ) )); On Jun 4, 11:29 am, shantamg jason.galu...@gmail.com wrote: yes, that about does it.. but what if i want to order by two fields? something like: Person.category_id asc, Person.name asc On Jun 2, 12:21 am, vekija vedran.konto...@gmail.com wrote: Not sure if I understood the question, but if you want Alix to appear before Shantam you can sort the assignment array with Set::sort Assuming your data array is called $shifts, you could do it like this foreach($shifts as $i = $shift) { $shifts[$i]['Assignment'] = Set::sort($data['Assignment'], '{n}.Person.name', 'asc'); } On Jun 2, 5:52 am, shantamg jason.galu...@gmail.com wrote: Shift hasMany Assignment Assignment belongsTo Person, Shift Person hasMany Assignment So if I do this: $this-Shift-find('all', array( 'contain' = 'Assignment.Person' )); I get something like this: Array ( [0] = Array ( [Shift] = Array ( [id] = 1 etc... [Assignment] = Array ( [0] = Array ( [id] = 1 [person_id] = 1 [shift_id] = 1 etc... [Person] = Array ( [id] = 1 [name] = Shantam etc... ) ) [1] = Array ( [id] = 2 [person_id] = 2 [shift_id] = 1 etc... [Person] = Array ( [id] = 2 [name] = Alix etc... ) ) etc ) ) ) So there's only ever one Person per Assignment. How can I order the Assignments by Person.name? Thanks, Jason 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: Validate data md5
I don't get that. I think that presents a false sense of security. It's best practice to use a secure connection whenever you're transmitting passwords. And if you're handling the request over secure http, then it doesn't matter if you send the password back to the user. On Jun 4, 10:08 am, vekija vedran.konto...@gmail.com wrote: When you have an error on the registration form, it is a best practice to clear the password value and force the user to renter that info. So, in the controller... if($this-User-save($this-data)) { // ... whatever you do after user had registered successfully} else { // ... there was an error $this-data['User']['password'] = null; } V On Jun 4, 4:21 pm, Chrriss polet...@wanadoo.fr wrote: Hi, I have a form to add a user and I use an md5 encryption when I save the password in the database. I use $validate to check if the email address is valid. If it's not, the form shows the data again with the error message but the password is not the right one in this case. It's the hashed password. So when I re-enter a valid email address, the password that is saved in the database is not the one I wanted! How can I do ? Thank you in advance! 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: Redirecting from javascript
I don't think you're understanding how a webpage works. JavaScript can't invoke PHP functions or any server-side functions. JavaScript is client-side. It's executed in the browser. The browser can send requests to the web server for web _pages_. That's what window.location does--it tells the browser to request the webpage at that location. You can't redirect a browser to a function. You _can_, however, redirect the browser to a URL that represents a controller action. If you don't know the standard URL for a controller action is, then you need to read the Cake Cookbook. The standard routing pattern for Cake is one of the most basic concepts you need to know for Cake development. So if you don't know that, chances are you haven't bothered to read the Cookbook at all, which is going to make developing a proper Cake application close to impossible. So start here: http://book.cakephp.org/view/879/Beginning-With-CakePHP The specific info you are looking for with regards to this question is here: http://book.cakephp.org/view/945/Routes-Configuration But I highly recommend at least skimming through the first 3 chapters of the Cookbook, if not the entire Cookbook. It will save you _so_ much trouble (trust me). On Jun 4, 1:22 pm, [-Cheluis-] tangu...@gmail.com wrote: How to redirect to another controller/function. From html you can do something like: ?php echo $html-link('Message', array('controller'='x','action'='y',$parm); ? How can I do this from js? window.location is enough? Thanks On Jun 4, 10:43 am, calvin cal...@rottenrecords.com wrote: Are you asking how to redirect to a different page in JavaScript? That's not really Cake-related, but it's window.location = 'your new page'. On Jun 3, 9:49 pm, [-Cheluis-] tangu...@gmail.com wrote: Hi! I was wondering if there is a way to redirect from one action to another via javascript. I want to do some validations and then, redirect the flow to one specific action. Any ideas? thanks Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Saving multiple rows of key-value pairs during a single update?
Did you define the relationship between User and MetaUser? i.e. in the User model: $hasMany = array('MetaUser' = array()); Because both, your approach and vekija's, should work. On Jun 4, 9:48 am, mwaterous m...@watero.us wrote: Well my last question here turned out to be between keyboard and chair, so hopefully this isn't quite as silly a question! I am learning Cake and building a custom user authentication system (who isn't?). I am trying to use two separate tables to store data, the User Model table as parent which stores only mission critical data (login, password, email, created, etc), and a MetaUser model table which is built around key value pairs (meta_id, user_id, meta_key, meta_value). Upon registration I have two pieces of meta information I would like to store - the activation code and an optin for receiving communication from site admins. I have built the forms as instructed by the Cake Book in order to use saveAll() in my Register action. The problem is that this results in the following array: Array ( [MetaUser] = Array ( [optin] = 1 [activation_code] = 9c1a26272907d4196a7bf39d [user_id] = 17 ) ) This obviously won't save since there is no optin or activation_code column in the MetaUser table. So I tried creating a beforeSave() under the presumption that if this was a numerical array it might try and add multiple rows on its own; public function beforeSave() { if ( isset( $this-data['MetaUser']['user_id'] ) ) { $userid = $this-data['MetaUser']['user_id']; $new = array(); $i = 0; foreach ( $this-data['MetaUser'] as $k = $v ) { $new[$i]['user_id'] = $user_id; $new[$i]['meta_key'] = $k; $new[$i]['meta_value'] = $v; $i++; } $this-data['MetaUser'] = $new; } return true; } But apparently it doesn't work that way. I'm going to try it next using distinct save()'s for $this-User and $this-MetaUser but am I missing something else that I should be doing instead? I want to create a MetaUser model where I can save each entry (even if multiple are coming from one form) as separate rows based on the key = value pair setup. 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: Query question(s)
POST requests are generally not cached, but you can force it to be cached using the Cache-Control and Expires headers. However, I've never tried this so I don't know if the browser will still show the form submission dialog (it may need to resend the form data to check to see if the document has changed since last requested). It probably won't, but I would still strongly advise against this. A search request is generally an idempotent operation (multiple requests do not have any side-effects), which is precisely what the GET request is designed for. There's no reason to use POST in this case. Cake has a perfectly good way of hiding ugly URL-encoding using its REST-style routing patterns, e.g.: http://yoursite.com/pages/search/foo/bar/foo2/bar2/... You can also use named parameters to make the search URL more readable, e.g.: http://yoursite.com/products/search/q:paegan/artist:acid+bath/category:t-shirt Unless you have a ton of search options, I see no reason to use POST. And even if you use POST and generate shorter/cleaner URL--what's the point? What will that clean URL achieve? The user can't bookmark it. They can't link a friend to it. They can't do anything with it. A happy compromise would be to do what a lot of forums do, and cache each search server-side. Then when the user performs a search (with either POST or GET), they get redirected to the cached search result, which might be something like: http://yoursite.com/search/paegan+terrorism+tactics/f83e3a4b389c6b That will decrease your server load, allow you to use a POST form, and still allow the user to bookmark/link the search results (at least for a time). On Jun 4, 10:40 am, Ed Propsner crotchf...@gmail.com wrote: I was checking out the book on complex queries and not really finding what I'm looking for. I'm trying to create a query that covers both a basic and advanced search. The form may be submitting all or just some of the options available on the page depending on what the user chooses. Once the form has been submitted clicking any one of the query results would navigate the user away from the 'results page'. To avoid getting hit with the form submission dialogue when the users clicks the back button to return to the search results page and to cover the 'conditional query' ... I used to use a combo of $_GET and if(isset. ie: $query= SELECT something FROM somewhere WHERE etc. etc. etc. AND ; if (isset($_GET['some_value']) $_GET['some_value'] != '' ) { $value = $_GET['some_value']; $query .= AND something = '.addslashes($value).'; } And so on. I'm not familiar with using cache for anything. To avoid using get and the ugly urls would I be able to use post and cache the results also avoiding the form submission dialogue when returning to the results page? Also, what is the best approach to setting up a 'conditional' query similar to what I posted above? I'll spend some more time digging through the book and experimenting if someone can point me in the right direction. 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
Re: Query question(s)
Thanks Calvin, point well taken. I'll just stick with GET like I always have for searches. I tweaked the routing and got things cleaned up a bit so I guess I'm okay with it. I'm not quite sure what I was expecting in the first place? 8-) The search uses a lot of checkboxes and results in something like http://mysite.com/search/results/value1=0value1=1value2=0value2=1. I can't seem to clean it up any more when submitting with GET, or am I still missing something? Anyhow, at least it's working the way that I want it to. I'm still having some issues with query so I'll quit fussing with the url for now. - Ed On Fri, Jun 4, 2010 at 10:15 PM, calvin cal...@rottenrecords.com wrote: POST requests are generally not cached, but you can force it to be cached using the Cache-Control and Expires headers. However, I've never tried this so I don't know if the browser will still show the form submission dialog (it may need to resend the form data to check to see if the document has changed since last requested). It probably won't, but I would still strongly advise against this. A search request is generally an idempotent operation (multiple requests do not have any side-effects), which is precisely what the GET request is designed for. There's no reason to use POST in this case. Cake has a perfectly good way of hiding ugly URL-encoding using its REST-style routing patterns, e.g.: http://yoursite.com/pages/search/foo/bar/foo2/bar2/... You can also use named parameters to make the search URL more readable, e.g.: http://yoursite.com/products/search/q:paegan/artist:acid+bath/category:t-shirt Unless you have a ton of search options, I see no reason to use POST. And even if you use POST and generate shorter/cleaner URL--what's the point? What will that clean URL achieve? The user can't bookmark it. They can't link a friend to it. They can't do anything with it. A happy compromise would be to do what a lot of forums do, and cache each search server-side. Then when the user performs a search (with either POST or GET), they get redirected to the cached search result, which might be something like: http://yoursite.com/search/paegan+terrorism+tactics/f83e3a4b389c6b That will decrease your server load, allow you to use a POST form, and still allow the user to bookmark/link the search results (at least for a time). On Jun 4, 10:40 am, Ed Propsner crotchf...@gmail.com wrote: I was checking out the book on complex queries and not really finding what I'm looking for. I'm trying to create a query that covers both a basic and advanced search. The form may be submitting all or just some of the options available on the page depending on what the user chooses. Once the form has been submitted clicking any one of the query results would navigate the user away from the 'results page'. To avoid getting hit with the form submission dialogue when the users clicks the back button to return to the search results page and to cover the 'conditional query' ... I used to use a combo of $_GET and if(isset. ie: $query= SELECT something FROM somewhere WHERE etc. etc. etc. AND ; if (isset($_GET['some_value']) $_GET['some_value'] != '' ) { $value = $_GET['some_value']; $query .= AND something = '.addslashes($value).'; } And so on. I'm not familiar with using cache for anything. To avoid using get and the ugly urls would I be able to use post and cache the results also avoiding the form submission dialogue when returning to the results page? Also, what is the best approach to setting up a 'conditional' query similar to what I posted above? I'll spend some more time digging through the book and experimenting if someone can point me in the right direction. 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 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