CakePHP Newbie Questions
Hi, I have recently started to learn CakePHP after just being used to coding from scratch. I have installed a couple of plugins but the issue I have is linking them together, for example if I have a login script then how on earth do I just show the login page for example? Does every Controller need to have a mysql assigned to it? I have been through the blog tutorial but so far it just feels really restrictive compared to just coding from scratch but what really appeals is the plugins / helpers but I am just struggling with basic things like echoing the username they are logged in with when logged in etc. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Flash messages redirect after a time interval?
Have a look at lines 33 and 34 of core.phphttps://github.com/cakephp/cakephp/blob/2.4.2/app/Config/core.php#L33. Is that referring to flash messages set by $this-Session-setFlash(); in the controller and then echo $this-Session-flash(); in the view? I have never witnessed the behavior described on line 33: In production mode, flash messages redirect after a time interval.. How is that automatic redirect supposed to happen? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Flash messages redirect after a time interval?
Wow, I've been using CakePHP for years and never even knew about flash; I've always just used setFlash. Thanks for the information! On Thursday, November 14, 2013 7:16:58 AM UTC-7, euromark wrote: That is an old behavior invoked by flash() directly, which most of use never ever use :) https://github.com/cakephp/cakephp/blob/master/lib/Cake/Controller/Controller.php#L1000 So I would just ignore that and use flash messages via setFlash() Mark Am Donnerstag, 14. November 2013 06:47:19 UTC+1 schrieb Nick Rogers: Have a look at lines 33 and 34 of core.phphttps://github.com/cakephp/cakephp/blob/2.4.2/app/Config/core.php#L33. Is that referring to flash messages set by $this-Session-setFlash(); in the controller and then echo $this-Session-flash(); in the view? I have never witnessed the behavior described on line 33: In production mode, flash messages redirect after a time interval.. How is that automatic redirect supposed to happen? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: integrating pusher.com with cakephp
OK, I'm still struggling, anyone with a working example of a real-time activity stream that updates the results in a view after a record is save. On Tuesday, 14 August 2012 15:05:10 UTC+1, Nick Crane wrote: I'm trying to implement a web socket with PUSHER within an existing cakephp 2.2.1 application. Has anyone attempted anything similar or come across any resources that define what is required, how this can be achieved? -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: integrating pusher.com with cakephp
OK, got it working with the pusher Event Creator fine, but when it came to including the $pusher-trigger('channel','event',arrayofdata); in a controller method, no joy, there seems to be a timing issue. Tried it with pubnub, a very similar implementation, it works fine. If anyone is that interested i can post a more detailed explanation. On Tuesday, 14 August 2012 15:05:10 UTC+1, Nick Crane wrote: I'm trying to implement a web socket with PUSHER within an existing cakephp 2.2.1 application. Has anyone attempted anything similar or come across any resources that define what is required, how this can be achieved? -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
integrating pusher.com with cakephp
I'm trying to implement a web socket with PUSHER within an existing cakephp 2.2.1 application. Has anyone attempted anything similar or come across any resources that define what is required, how this can be achieved? -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: integrating pusher.com with cakephp
Thanks for the info, I hope it's that simple, I'll give it a go and update the post. Thanks again. On Tuesday, 14 August 2012 15:05:10 UTC+1, Nick Crane wrote: I'm trying to implement a web socket with PUSHER within an existing cakephp 2.2.1 application. Has anyone attempted anything similar or come across any resources that define what is required, how this can be achieved? -- You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: cake php installation on fedora
my problem is im using a step by step procedure in youtube and this is the link installation cakephp 1.3.2 on linuxhttp://www.youtube.com/watch?v=9stiBWz71Tsfeature=related as i follow the instruction, this procedure is more likely use in ubuntu.. the code using to bake in the instruction over the video is *sudo apt -get install cakephp* a ubuntu command...and my question is what command i will use if my linux using is fedora..using this instruction/procedure in the video On Thu, Jun 16, 2011 at 12:08 PM, nickdecillo nickdeci...@gmail.com wrote: Im installing cakephp using putty on fedora and i was stuck in process when you need to install it and access it to bake.. can you help me with a simple steps to make this successful using putty.. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Problem with blog example - Cake 1.3.3 PHP version?
This seems very basic but I am trying the blog example line by line. I am using Cake version 1.3.3 When I try the add post basically adding functionality to add the post, everything works fine until I try to save the new record. I get the error - Fatal error: Cannot access empty property in /home/ nick/www/blog/cake/libs/model/model.php on line 978 I looked further and found on model.php#978 access like this - $this-{$model} Now removing braces and $ worked! i.e. $this-model is fine without any errors. This is not the right fix, I know because $this-model is not even set but the property access itself was a problem before. Not sure if this is PHP4 / PHP5 difference, but I assumed Cake 1.3.3 works on PHP5. Any insight will be highly appreciated. The server that I am using is - Apache/2.0.54 (Ubuntu) PHP/5.0.5-2ubuntu1.8 Thanks 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
unable to use fusioncharts in view
Hi guys, I want to use fusioncharts in my cakephp application but the swf file to display the chart does not seem to be loading. In the same folder as my view, I have a directory called charts with all the swf files. Here is the code to load the file for the chart data. echo renderChart(Charts/Column3D.swf, , $strXML, productSales, 600, 300, false, false); I have also included the php file with the function renderChart in the same view: include(FusionCharts.php); The problem is that only the area (600,300) for the chart is loading without the Chart itself. Is there a better way to do this and where exactly is the problem? Thanks 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: error with cake bake model/view/controller
Hi Hayden, I'm just learning Cake myself, and I had exactly the same problem with MAMP. Have a look here: http://marshallthompson.net/uncategorized/mamp-socket-error-no-such-file-fix The second (permanent) fix doesn't work for me, but the first one does. With MAMP running, fire up your Terminal and do: ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock Seems to have done the trick for me. You'll need to do that each time you restart MAMP I suppose. All the best nick 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
Captcha validation in model
Hello, i am trying to set up pretty simple board application and came wit a problem of captcha validation. Problem occures when validating the form as one because i use $validation array method in my model and most captchas components use validation in controller, which sets a problem of validation priorities since i have some costum validation functions in my model. what i would like to achieve is that the validation errors would show under each input field (including captcha field) when post is submitted. ive tried some components that i found in bakery but couldnt get it rolling because i run into validation problems. if someone has a solution for this problem i would really appriciate this. Thanks, Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email 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: error 404 throws blank page
Exactly what I just did. Turns out it was an issue with using the Javascript helper in my default.ctp file. When it called error404.ctp the error controller didn't have javascript added as a helper and therefore threw a blank page. Once I added that I got my 404 error. Thanks for the quick suggestion. On Jan 25, 3:01 am, Miles J mileswjohn...@gmail.com wrote: Perhaps set your debug to 2 and see if it throws an error why? On Jan 24, 11:53 pm, Nick nlof...@gmail.com wrote: I can't seem to figure out what I did wrong or where to fix it, but I've got my debug level set to 0 in my core.php file and saved the default cake 404 error message page into app/views/errors/ but every time I go to an invalid controller url, I get a blank page instead of the 404 error message. I've dug through everything I could think of, but don't see anything I could have done to cause this. Thanks for any help anyone can provide, I'm pulling my hair out over this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
error 404 throws blank page
I can't seem to figure out what I did wrong or where to fix it, but I've got my debug level set to 0 in my core.php file and saved the default cake 404 error message page into app/views/errors/ but every time I go to an invalid controller url, I get a blank page instead of the 404 error message. I've dug through everything I could think of, but don't see anything I could have done to cause this. Thanks for any help anyone can provide, I'm pulling my hair out over this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Radio Button onClick
What Im trying to do is list some events as radio buttons. When one of the buttons is clicked I wanted it to populate three textareas with the data from that event record. ie: when clicking on wedding the Event.name, Event.description, Event.information would be populated into the three textareas. The problem Im having is how to use the $form helper to get it to work. The following are what I've tried // Option #1 // // controllers/events_controller.php // $events = $this-Event-find('list'); $this-set(compact('events')); // // views/events/create_event.ctp // echo $form-input('Event', array( 'div' = true, 'label' = true, 'type' = 'radio', 'options' = $events, 'onClick' = '$(EventName).value=aklsdjflkj' )); problem with #1 is that I need to loop to access the correct Event.name, Event.description, Event.information for the onClick event. Right now with the find set to 'list', I don't have access to that. If I use the find query from step two here, I wouldn't know how to access the correct Event.name, Event.description, Event.information without being in a loop. Plus the label says array rather than the appropriate Event.name. // Option #2 // // controllers/events_controller.php // $events = $this-Event-find('all', array( conditions = array( Event.template = 1 ) ) ); $this-set(compact('events')); // // views/events/create_event.ctp // foreach($events as $event) { echo $form-input('Event.name', array( 'div' = true, 'label' = true, 'type' = 'radio', 'options' = $event[Event][name], 'value' = $event[Event][id] )); } // Problem with #2 is that when I put this in a loop, everything gets messed up with the ids and the names of the inputs. Plus they are all in there own div rather than being together. Im pretty new at cake, but have been programming php for many years. Any help is greatly appreciated. Thanks so much, Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email 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 -~--~~~~--~~--~--~---
Odd AuthComponent behavior
Has anyone else seen this, it appears to only happen when using the auth component with cookies. If I have an e-mail that begins with a number, the auth component authenticates the wrong user. It takes whatever the leading number is and logs in the user with the ID of that number, instead of the user with the correct e-mail address. Any other e-mail account login works fine, as long as it doesn't begin with a number. Here's what my code looks like: In my User Model I use this to check the login and find the correct user: function checkLogin($email) { $user = $this-findByEmail($email); if ($user) { return $user; } return null; } In my AppController: $this-Auth-loginAction= array('controller' = 'users', 'action' = 'login'); $this-Auth-logoutRedirect = '/'; $this-Auth-loginError = 'Either your Email or Password are incorrect. Please try again'; $this-Auth-authError = 'Please Log In before attempting to access this page.'; $this-Auth-autoRedirect = false; $cookie = $this-Cookie-read('User'); if (is_array($cookie) !$this-Auth-user()) { $loginUser = $this-User-checkLogin($cookie['email']); if (isset($loginUser)){ $loginSuccess = $this-Auth-login($loginUser); if (!$loginSuccess){ $this-Cookie-del('User'); } } } And in my UsersController: function login() { if ($this-Auth-User()){ if (!empty($this-data)){ if (!($this-data['User']['remember'])){ $this-Cookie-del('User'); } else { $cookie = array(); $cookie['email'] = $this-data['User']['email']; $this-Cookie-write('User',$cookie,true,'+2 weeks'); } unset($this-data['User']['remember']); } $this-redirect($this-Auth-redirect()); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email 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: Odd AuthComponent behavior
Nevermind, I should have looked at the API first. I stripped some of the data I was passing to $this-Auth-login(); I changed it from $this-Auth-login($loginUser); to $this-Auth- login($loginUser['User']['id']); Its now authenticating the correct user. On Dec 26, 1:43 pm, Nick nlof...@gmail.com wrote: Has anyone else seen this, it appears to only happen when using the auth component with cookies. If I have an e-mail that begins with a number, the auth component authenticates the wrong user. It takes whatever the leading number is and logs in the user with the ID of that number, instead of the user with the correct e-mail address. Any other e-mail account login works fine, as long as it doesn't begin with a number. Here's what my code looks like: In my User Model I use this to check the login and find the correct user: function checkLogin($email) { $user = $this-findByEmail($email); if ($user) { return $user; } return null; } In my AppController: $this-Auth-loginAction = array('controller' = 'users', 'action' = 'login'); $this-Auth-logoutRedirect = '/'; $this-Auth-loginError = 'Either your Email or Password are incorrect. Please try again'; $this-Auth-authError = 'Please Log In before attempting to access this page.'; $this-Auth-autoRedirect = false; $cookie = $this-Cookie-read('User'); if (is_array($cookie) !$this-Auth-user()) { $loginUser = $this-User-checkLogin($cookie['email']); if (isset($loginUser)){ $loginSuccess = $this-Auth-login($loginUser); if (!$loginSuccess){ $this-Cookie-del('User'); } } } And in my UsersController: function login() { if ($this-Auth-User()){ if (!empty($this-data)){ if (!($this-data['User']['remember'])){ $this-Cookie-del('User'); } else { $cookie = array(); $cookie['email'] = $this-data['User']['email']; $this-Cookie-write('User',$cookie,true,'+2 weeks'); } unset($this-data['User']['remember']); } $this-redirect($this-Auth-redirect()); } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email 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: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working
I've traced the issue to something with my On Nov 30, 12:52 am, Nick [EMAIL PROTECTED] wrote: I'm desperate for some help here... I just built a brand new ubuntu intrepid server and copied everything from my cake folders on my Ubuntu Hardy box to the new intrepid server. If I extract a fresh version of Cake, everything works fine, css shows up, db calls work correctly, etc., but everything is failing when I copy all my work over. I see no CSS formatting and I get the following error: Fatal error: Call to undefined function mysql_connect() in /home/phazo/ Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on line 117 I've dumped my sql database and imported it on the new device triple checked the sql accounts made sure my tmp directory is writeable enabled MOD rewrites verified my .htaccess files exist set AllowOverride all for my directories in the apache2.conf file what else could I be missing? Thanks for any help anyone can provide! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working
I've traced the issue to the database.php file. If this file doesn't exist, then the CSS renders correctly. If this file exists, then everything goes haywire. This happens whether I add the correct mysql login data or bogus data. There is a difference between the versions of mysql between the two boxes: Old: 5.0.51a-3ubuntu5.4 (Ubuntu) New: 5.0.67-0ubuntu6 (Ubuntu) Anyone know of any issues with the new version of MySql or Ubuntu? On Nov 30, 12:52 am, Nick [EMAIL PROTECTED] wrote: I'm desperate for some help here... I just built a brand new ubuntu intrepid server and copied everything from my cake folders on my Ubuntu Hardy box to the new intrepid server. If I extract a fresh version of Cake, everything works fine, css shows up, db calls work correctly, etc., but everything is failing when I copy all my work over. I see no CSS formatting and I get the following error: Fatal error: Call to undefined function mysql_connect() in /home/phazo/ Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on line 117 I've dumped my sql database and imported it on the new device triple checked the sql accounts made sure my tmp directory is writeable enabled MOD rewrites verified my .htaccess files exist set AllowOverride all for my directories in the apache2.conf file what else could I be missing? Thanks for any help anyone can provide! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working
Thanks for the suggestions, you were right, I went through the phpinfo () for the old and new servers and was actually missing one of the core components. Completely overlooked it without even thinking about it. Was missing the mysql module for PHP5... yah slightly important. :-p All is working now, thanks for the pointers! On Nov 30, 5:17 pm, Howard Glynn [EMAIL PROTECTED] wrote: Are you sure you have sufficient php modules installed with ubuntu package manager? I would compare your phpinfo() on the original box versus the new box(), or even just have a look at what is ticked related to php on synaptic package manager. If I saw that error message I'd be looking at libraries straight away. You may not get everything you think you ought to by default. On Sun, Nov 30, 2008 at 5:52 AM, Nick [EMAIL PROTECTED] wrote: I'm desperate for some help here... I just built a brand new ubuntu intrepid server and copied everything from my cake folders on my Ubuntu Hardy box to the new intrepid server. If I extract a fresh version of Cake, everything works fine, css shows up, db calls work correctly, etc., but everything is failing when I copy all my work over. I see no CSS formatting and I get the following error: Fatal error: Call to undefined function mysql_connect() in /home/phazo/ Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on line 117 I've dumped my sql database and imported it on the new device triple checked the sql accounts made sure my tmp directory is writeable enabled MOD rewrites verified my .htaccess files exist set AllowOverride all for my directories in the apache2.conf file what else could I be missing? Thanks for any help anyone can provide! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Copied cake PHP files to a new Ubuntu Intrepid box and nothing is working
I'm desperate for some help here... I just built a brand new ubuntu intrepid server and copied everything from my cake folders on my Ubuntu Hardy box to the new intrepid server. If I extract a fresh version of Cake, everything works fine, css shows up, db calls work correctly, etc., but everything is failing when I copy all my work over. I see no CSS formatting and I get the following error: Fatal error: Call to undefined function mysql_connect() in /home/phazo/ Dropbox/www/lymtest3/cake/libs/model/datasources/dbo/dbo_mysql.php on line 117 I've dumped my sql database and imported it on the new device triple checked the sql accounts made sure my tmp directory is writeable enabled MOD rewrites verified my .htaccess files exist set AllowOverride all for my directories in the apache2.conf file what else could I be missing? Thanks for any help anyone can provide! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
How to dynamically load controller based on field in database.
Basically I am using wildflower cms which is built on cakephp. It routes are setup so that / goes to the pages controller. I am building a product catalog and could simply have the urls be / products/category/product-name however I do not want to prepend the controller name in this scenario. Right now I have it so that the product controller from the admin side will insert rows into the pages table as products are created in the products table. Also I created a field in the pages table called controller. By default it is blank however what I want to do is if it isn't blank and for example has Products in it then I want to load the Products controller from within the Pages controller so that it can handle pulling the product images, pricing, etc... I want the controller to be dynamically called. Url structure example desired: /shirts/mens/rockstar-shirt/- goes to pages controller sees that the controller field has Product and loads product through Product Controller /about-us/ - goes to pages controller and has blank controller field, page rendered as normal Im new to cake but like it so far. Also does anyone know of a good cake cms, wildflower is slow running as localhost. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Desparately trying to search a single DB field for multiple individual terms with find()
I'm hoping someone can help. I'm fairly new to CakePHP but am thoroughly enjoying coding with it. Basically I've got a field within a table that contains my content. I'm trying to grab the search terms from a single input, explode them and search the content section for each term individually. I'm doing something along these lines: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR']['Question.content LIKE'] = array(% $splitTerm%); endforeach; $this-set('questions',$this-Question-find('all',$conditions)); My dilemma is basically in setting the conditions... because 'Question.content LIKE' can only contain one value, I can't build an array within my foreach loop that I can then pass to the find method to build a full SQL query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Desparately trying to search a single DB field for multiple individual terms with find()
Yes, thats my biggest issue, I don't know if there is a way within Cake to define multiple array values for 'Question.content LIKE' I've tried building it like this, however the SQL query built off of this array isn't correct: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR'] ['Question.content LIKE'][$i]= (% $splitTerm%); $i++; endforeach; $this-set('questions',$this-Question-find('all',$conditions)); On Nov 5, 2:38 pm, teknoid [EMAIL PROTECTED] wrote: Seems like you are overriding your condition each time... On Nov 5, 1:49 pm, Nick [EMAIL PROTECTED] wrote: I'm hoping someone can help. I'm fairly new to CakePHP but am thoroughly enjoying coding with it. Basically I've got a field within a table that contains my content. I'm trying to grab the search terms from a single input, explode them and search the content section for each term individually. I'm doing something along these lines: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR']['Question.content LIKE'] = array(% $splitTerm%); endforeach; $this-set('questions',$this-Question-find('all',$conditions)); My dilemma is basically in setting the conditions... because 'Question.content LIKE' can only contain one value, I can't build an array within my foreach loop that I can then pass to the find method to build a full SQL query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Desparately trying to search a single DB field for multiple individual terms with find()
I've been staring at the manual all day... maybe I am missing something and if so, my bad. If I build an or statement without the foreach loop, I would do it as follows: $conditions = array( 'conditions'= array( 'OR' = array( 'Question.content LIKE' = this, 'Question.content LIKE' = that ) ) ); This is the problem, the second Question.content will overwrite the first. Is there any way to build an OR statement where you can look for multiple variables within the same database field? Either way, I think I've accomplished what I set out to by doing the following and simply building a regex on the fly, I'd LOVE to know if there is a simpler way to do this as I doubt this is the easiest way: $i = 1; $regString = ^; $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): if (count($splitTerms) != $i){ $regString = $regString.$splitTerm.{1,}|^; } else { $regString = $regString.$splitTerm.{1,}; } $i++; endforeach; $conditions = array('conditions'= array('Question.content REGEXP' = $regString)); $this-set('questions',$this-Question-find('all',$conditions)); On Nov 5, 3:28 pm, teknoid [EMAIL PROTECTED] wrote: Nothing to do with cake. Your usage is incorrect. Please review how to correctly build an 'OR' condition in the manual, there are multiple examples. On Nov 5, 2:45 pm, Nick [EMAIL PROTECTED] wrote: Yes, thats my biggest issue, I don't know if there is a way within Cake to define multiple array values for 'Question.content LIKE' I've tried building it like this, however the SQL query built off of this array isn't correct: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR'] ['Question.content LIKE'][$i]= (% $splitTerm%); $i++; endforeach; $this-set('questions',$this-Question-find('all',$conditions)); On Nov 5, 2:38 pm, teknoid [EMAIL PROTECTED] wrote: Seems like you are overriding your condition each time... On Nov 5, 1:49 pm, Nick [EMAIL PROTECTED] wrote: I'm hoping someone can help. I'm fairly new to CakePHP but am thoroughly enjoying coding with it. Basically I've got a field within a table that contains my content. I'm trying to grab the search terms from a single input, explode them and search the content section for each term individually. I'm doing something along these lines: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR']['Question.content LIKE'] = array(% $splitTerm%); endforeach; $this-set('questions',$this-Question-find('all',$conditions)); My dilemma is basically in setting the conditions... because 'Question.content LIKE' can only contain one value, I can't build an array within my foreach loop that I can then pass to the find method to build a full SQL query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Desparately trying to search a single DB field for multiple individual terms with find()
OH MAN! I see exactly what I was missing, I wasn't defining each condition within the OR array as an array! Thank you for pointing it out. I must have typed and re-typed those lines so many times that I just overlooked it... That settled it, thanks a ton for the help! On Nov 5, 4:27 pm, teknoid [EMAIL PROTECTED] wrote: How can you tell me you looked at the manual, when the example is right there in complex find conditions?http://book.cakephp.org/view/74/Complex-Find-Conditions (I know 'cause I remember adding it :)) $this-Post-find('all', array('conditions'=array( 'OR'=array(array('Post.title LIKE'='this'), array('Post.title LIKE'='that') ; On Nov 5, 3:54 pm, Nick [EMAIL PROTECTED] wrote: I've been staring at the manual all day... maybe I am missing something and if so, my bad. If I build an or statement without the foreach loop, I would do it as follows: $conditions = array( 'conditions'= array( 'OR' = array( 'Question.content LIKE' = this, 'Question.content LIKE' = that ) ) ); This is the problem, the second Question.content will overwrite the first. Is there any way to build an OR statement where you can look for multiple variables within the same database field? Either way, I think I've accomplished what I set out to by doing the following and simply building a regex on the fly, I'd LOVE to know if there is a simpler way to do this as I doubt this is the easiest way: $i = 1; $regString = ^; $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): if (count($splitTerms) != $i){ $regString = $regString.$splitTerm.{1,}|^; } else { $regString = $regString.$splitTerm.{1,}; } $i++; endforeach; $conditions = array('conditions'= array('Question.content REGEXP' = $regString)); $this-set('questions',$this-Question-find('all',$conditions)); On Nov 5, 3:28 pm, teknoid [EMAIL PROTECTED] wrote: Nothing to do with cake. Your usage is incorrect. Please review how to correctly build an 'OR' condition in the manual, there are multiple examples. On Nov 5, 2:45 pm, Nick [EMAIL PROTECTED] wrote: Yes, thats my biggest issue, I don't know if there is a way within Cake to define multiple array values for 'Question.content LIKE' I've tried building it like this, however the SQL query built off of this array isn't correct: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR'] ['Question.content LIKE'][$i]= (% $splitTerm%); $i++; endforeach; $this-set('questions',$this-Question-find('all',$conditions)); On Nov 5, 2:38 pm, teknoid [EMAIL PROTECTED] wrote: Seems like you are overriding your condition each time... On Nov 5, 1:49 pm, Nick [EMAIL PROTECTED] wrote: I'm hoping someone can help. I'm fairly new to CakePHP but am thoroughly enjoying coding with it. Basically I've got a field within a table that contains my content. I'm trying to grab the search terms from a single input, explode them and search the content section for each term individually. I'm doing something along these lines: $term = $this-data['Question']['searchTerm']; $splitTerms = explode( ,$term); foreach($splitTerms as $splitTerm): $conditions['conditions']['OR']['Question.content LIKE'] = array(% $splitTerm%); endforeach; $this-set('questions',$this-Question-find('all',$conditions)); My dilemma is basically in setting the conditions... because 'Question.content LIKE' can only contain one value, I can't build an array within my foreach loop that I can then pass to the find method to build a full SQL query. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from
Multiple table association problem
I think I'm confusing myself. I've read several posts, but haven't got the right solution. I have a model called Properties that facilitates the addition, deletion, or editing of a property. Each property has 300 questions tied to it. These question answers (boolean true/false) are found in the Answer model. The table structure for the answer model is: ID, question_id, property_id, response The question model allows addition or deletion of questions, and its structure is: id, question, points, category_id The category model allows addition or deletion of categories, and its structure is: id, name So. When a user creates a property, they then need to respond to the 300 questions. Each question response is a row entry into the answers table. The end result needs to be a property array that has the property information, question, answer, and the category that each question belongs in. As of right now, I have a hasAndBelongsToMany between Property and Answer, so I'm able to see the property information in the array, and the answers -- but I need to relate the questions in there too (based off of the question ID that's in the answer). Any ideas? I tried doing a multiple HABTM -- but it didn't quite turn out right. I know I could do this manually, but I want to do it correctly so I can save time in the future. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Login box in layout
Thank you very much for advices, Dave! I think I'll try AJAX - it will be good practice for me ;) Cheers, Nick Dave J wrote: Hey Nick, You're right about that. I guess you can tackle it either two ways. 1) Submit the form using AJAX, so if there's any errors, you get them back without a page refresh. And on successful login, you could either hide the login form and replace it with a 'logged-in' message. Or send back a JS command to refresh the page, so the page would reflect the new logged-in status 2) Or use the flash feature of the Session Component/Helper to return any errors as soon as the page refreshes. (Just make sure you have $session-flash() somewhere in your layout) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
no finderQuery data (cake 1.2 beta)
Hi guys I'm currently towards the end of a major app build and have today upgraded cake to the beta release, mainly to fix a pagination issue with the nightly I was using. Anyhow, I now have a far more serious problem in that my finderQuery data is being lost somewhere. In previous Cake, with debug on I could see the initial SELECT query, followed by a series of SELECT's based on my finderQuery to pull the association for each record found in the first query, ie SELECT ... WHERE Model.id IN (xx). With the beta, I instead see a single query for the finderQuery which will grab data for all of the rows found in the first query, ie: SELECT ... WHERE Model.id IN (xx,xx,xx,xx,xx). This is all fine and dandy obviously, we all like to see speed improvements and less queries. The only problem is that the data never makes it to my model - the associations are always blank - even though I can see the query being executed. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help..How to run cakephp in winxp?
Thank you very much~you are so nice!! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Help..How to run cakephp in winxp?
but ...why not this Screen? http://picasaweb.google.com.tw/nickalbum12/20080111/photo#5154058531461024354 On 1月11日, 下午1時46分, Louie Miranda [EMAIL PROTECTED] wrote: As i can see it. It is already running. On Jan 11, 2008 12:10 PM, Nick [EMAIL PROTECTED] wrote: --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Help..How to run cakephp in winxp?
I can't run cakephp in XP. my localhost display CakePHP Rapid Development Your database configuration file is present. Cake is able to connect to the database. Can you help me? All Screencasts: http://picasaweb.google.com.tw/nickalbum12/20080111 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Failure to JOIN and query correctly beyond $recursive = 1 - workarounds or fixes welcome, maybe a bug?
No private emails please. The bulk of your question is answered in the first result of that search: Sorry, it was actually intended for the group. And thanks for the link. I think it was one that I'd seen already, but doesn't have an explanation other than a vague comment that the limitation is required for Cake's Models to do their associative data mapping magic. Having multiple queries where there would be repeated data is certainly fair enough, but an algorithm to combine one to one mappings into a near optimal single query should be possible, particularly in the trivial case described. If it turned out to be to hard to get right in some cases when some other associations are involved for example, then provided that a schema can be determined to be simple or hairy, an appropriate algorithm could be selected as necessary. So it is a weakness, but not the end of the world as one can always use a handbuilt query without too much effort. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Failure to JOIN and query correctly beyond $recursive = 1 - workarounds or fixes welcome, maybe a bug?
Using the latest 1.2 release (and earlier ones), I'm finding that queries that could be performed with a JOIN are breaking into multiple single row queries at $recursive = 2 or more. In fact worse, there is a JOIN and some single queries that duplicate part of the JOIN for one of the tables. I may well be missing something, but it's not clear to me what that might be. (Skip to THE PROBLEM to get to the issue without the setup details.) The models in this example are A_Thing, B_Thing, C_Thing. Having one to one mappings, a C_Thing belongs to a B_Thing, and a B_Thing belongs to an A_Thing. In the DB we have: mysql describe a_things; ++-+--+-+-++ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-++ | id | int(11) | NO | PRI | NULL| auto_increment | | b_thing_id | int(11) | NO | | || ++-+--+-+-++ mysql describe b_things; ++-+--+-+-++ | Field | Type| Null | Key | Default | Extra | ++-+--+-+-++ | id | int(11) | NO | PRI | NULL| auto_increment | | c_thing_id | int(11) | NO | | || ++-+--+-+-++ mysql describe c_things; +---+-+--+-+-++ | Field | Type| Null | Key | Default | Extra | +---+-+--+-+-++ | id| int(11) | NO | PRI | NULL| auto_increment | +---+-+--+-+-++ In my test DB we have A_Thing = values (1,5), B_Thing = values (5,10), C_Thing = values (10) Model classes are: class AThing extends AppModel { var $name = 'AThing'; var $useDbConfig = 'cake'; var $primaryKey = 'id'; var $recursive = 2; var $belongsTo = array('BThing'); } class BThing extends AppModel { var $name = 'BThing'; var $useDbConfig = 'cake'; var $primaryKey = 'id'; var $belongsTo = array('CThing'); } class CThing extends AppModel { var $name = 'CThing'; var $useDbConfig = 'cake'; var $primaryKey = 'id'; } THE PROBLEM: If we set $recursive to 1, we get the A_Thing and it's B_Thing as expected, and the query is a correct JOIN: SELECT `AThing`.`id`, `AThing`.`b_thing_id`, `BThing`.`id`, `BThing`.`c_thing_id`, `BThing`.`a_thing_id` FROM `a_things` AS `AThing` LEFT JOIN `b_things` AS `BThing` ON (`AThing`.`b_thing_id` = `BThing`.`id`) WHERE `AThing`.`id` = 1 LIMIT 1 However if we set $recursive to 2, we get: SELECT `AThing`.`id`, `AThing`.`b_thing_id`, `BThing`.`id`, `BThing`.`c_thing_id`, `BThing`.`a_thing_id` FROM `a_things` AS `AThing` LEFT JOIN `b_things` AS `BThing` ON (`AThing`.`b_thing_id` = `BThing`.`id`) WHERE `AThing`.`id` = 1 LIMIT 1 SELECT `BThing`.`id`, `BThing`.`c_thing_id`, `BThing`.`a_thing_id` FROM `b_things` AS `BThing` WHERE `BThing`.`id` = 5 SELECT `CThing`.`id`, `CThing`.`b_thing_id` FROM `c_things` AS `CThing` WHERE `CThing`.`b_thing_id` = 5 So instead of the retrieval of C being part of what should be still one query, we get the original query, a duplicate query on B_Things, plus the one for C_Things. This behaviour is also the same if we use hasOne instead and the schemas have back instead of forward linking fields (present in these query results after modifying the DB to test that). The returned data is as below, which seems to be correct although it's not clear to me why C_Thing is nested inside B_Thing (as I'd expect) but B_thing is not tested inside A_Thing - any explanation of that would be welcome too. Array ( [AThing] = Array ( [id] = 1 [b_thing_id] = 5 ) [BThing] = Array ( [id] = 5 [c_thing_id] = 10 [a_thing_id] = 1 [CThing] = Array ( [id] = 10 [b_thing_id] = 5 ) ) ) Any help much appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Failure to JOIN and query correctly beyond $recursive = 1 - workarounds or fixes welcome, maybe a bug?
Just to correct the query results as that was after modifying the schema. The full depth queries are: SELECT `AThing`.`id`, `AThing`.`b_thing_id`, `BThing`.`id`, `BThing`.`c_thing_id` FROM `a_things` AS `AThing` LEFT JOIN `b_things` AS `BThing` ON (`AThing`.`b_thing_id` = `BThing`.`id`) WHERE `AThing`.`id` = 1 LIMIT 1 SELECT `BThing`.`id`, `BThing`.`c_thing_id` FROM `b_things` AS `BThing` WHERE `BThing`.`id` = 5 SELECT `CThing`.`id` FROM `c_things` AS `CThing` WHERE `CThing`.`id` = 10 If we add a name column to C_Things to make it have something useful, the query need just be: SELECT `AThing`.`id`, `AThing`.`b_thing_id`, `BThing`.`id`, `BThing`.`c_thing_id`,`CThing`.`name` FROM `a_things` AS `AThing` LEFT JOIN `b_things` AS `BThing` ON (`AThing`.`b_thing_id` = `BThing`.`id`) LEFT JOIN `c_things` as `CThing` on (`BThing`.`c_thing_id` = `CThing`.`id`) WHERE `AThing`.`id` = 1 LIMIT 1; This is presumably a bug or weakness in the current DB implementation. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Member Methods in Views
Cake 1.x does have this wrong although not intentionally, but there is enough flexibility to deal with it. As others noted, it's fundamental to OO design that rather than having functions that are passed data to operate on, the data contains the behaviour and operates upon itself. Message passing languages such as Smalltalk make this particularly clear, but in cake the data are not objects. What I initially wanted as soon as I started with cake was model data not to be raw fields, but where appropriate to be comprised of object instances so that those instances can then be asked to perform operations. As an example, if a table row contains fields that model two address instances, having called find I wanted to see the data with two Address class instances rather than the underlying fields. Similarly when storing a model, the data saved would contain object instances rather than raw fields. What I didn't do was have the entire row being a model instance, but I've realised that it needs to be too in some if not all cases. To implement this, and one of the reasons that cake is great is that it was trivial to do, was to create a behaviour that implemented before/after methods, and I specified a model member variable as an array that listed the classes that a database row was comprised of, and that optionally would name the instance (so for address this might be home, work, holiday etc.). The name corresponded to a column prefix in the schema. The model then just acts as this new behaviour and all find and save operations can work with class instances where appropriate instead of raw columns. A little performance overhead but nice to be in the world of objects again rather than data fragments. The bigger win will be when the entire row is a class instance and that's coming next. I'll post the behaviour in due course in case it's useful to anyone else. Despite the shortcomings, thumbs up to cake for having the flexibility to extend easily. I've found myself almost over enthusiastically extolling the virtues of Cake to two people recently because even when there's one step backwards, there's then two steps forward and it gives the feelgood factor again. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Wrong fieldset type for MySQL SET datatype. Workaround?
Hi all, I've been using the Form helper within a form creator helper that I've put together, and using the Form helper's fieldset data that contains the field type details. This has worked great, but I've just found that whilst the enum types are reported correctly, the SET type just shows as type text. E.g. MySQL describe (partial): | period | enum('hour','day','week','month','year') | | types | set('A','B','C','D') | Form helper fieldset data: Array ( // other stuff [period] = enum('hour','day','week','month','year') [types] = text ) I haven't explored yet, but it seems at first glance as if Cake isn't handling the SET datatype when analysing the schemas. Just wondered whether anyone come across this and made a workaround, or am I missing something and is there another route to getting the correct type without running an explain query directly? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Wrong fieldset type for MySQL SET datatype. Workaround?
After checking the dbo files, set is indeed missing for the mysql and mysqli drivers so a simple patch is to add if (strpos($col, 'set') !== false) { return set($vals); } or similar after the enum case and then all works well. Not sure if there's a reason why it wasn't there, but I suspect just an oversight. Cheers Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Stuck - Join limitation in 1.2?
Hi We're exploring CakePHP, and I'm stuck on how to describe the following model relationship. It should be trivial and I'm sure that I'm missing something, but precisely what eludes me. Can anyone help? Let's say that we have a model 'Person', and one of the attributes for Person is country. The value of country is the primary key into a table of Countries. $hasOne can express that Person should join on Countries, but the join is made against Person.id, and I cannot find a way to express that the field in Person to use for the join is country. Checking the archives, floepi posted a tweak back in January to add an associatedKey attribute for $hasOne to express this notion, but I wondered whether something like this is now standard in 1.2. Cheers Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Stuck - Join limitation in 1.2?
Thanks for the reply Joshua On Jun 12, 8:21 pm, Joshua Benner [EMAIL PROTECTED] wrote: To, it sounds like: Person belongsTo Country I'd use a belongsTo relationship in the Person model. Correct, this was a bad example, and in this case I'd tend to agree and that type of relationship does work. Replacing Country with Thing, and considering that each person has a Thing is closer to what I was thinking. Things know nothing about people, and are just things. Each person will always have just one thing, so we don't need the flexibility of a join table to associate an arbitrary number of Things with a person. A belongsTo relationship will do the job but seems incorrect as in this case a Person has a Thing, and a Person does not belong to a Thing. What is the case though is that the actual value in the Thing column of a Person does belong to Things, and if we consider that then it does make sense. So whilst Person as a whole does not belong to Thing, the Thing *value* of a Person does belong to Thing. Another example would be Colour, where all manner of models might have Colour as an attribute, but the models would not belong to colour. I wrote a bit on understanding the practical differences between relationships here:http://bennerweb.com/node/16 This is a great article, although you show why there is the confusion when you write each movie has one director but then model that relationship with belongsTo and not hasOne :) Aside from the fact that belongsTo would work and hasOne wouldn't, as a movie is the creative work of a director it would be fair enough to consider that a movie belongs to a director, but in some cases I feel that hasOne would be the clearer and more natural choice as this is how we would explain the model to someone. It's evidently unnecessary for an enhancement to hasOne, however for the sake of expressiveness, being able to use hasOne or perhaps an isA concept might be clearer. Thanks again for the helpful reply though. Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Caching XML views
Hi guys, I'm currently creating RSS feeds using a separate layout with header(Content-Type: text/xml); inside of it, which all works fine and dandy. The problems occur when trying to push the code into my live environment which relies on caching due to heavy traffic. I am now getting unexpected T_STRING errors due to the ?xml in the cache file (I'm echo'ing this line via PHP in the view). Is there a solution for this problem other than disabling short tags in PHP? if I have to go this route then so be it but it's a large app and there is heavy use of short tags unfortunately. Many thanks, Nick J. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Lighttpd and GET
I am trying to get v 1.1.12.4205 running on a Lighttpd server. Everything seems to be working aside from $_GET requests like these: http://www.chattypet.org/pets/?page=2 page=2 would not get picked up in this example. I have no access to it through $this-params and $_GET in Cake. My configuration for the host in lighttpd.conf is as follows: One guess is that because index.php?url= is being used in rewrite, the GET info is getting chopped off, can anyone help? $HTTP[host] == chattypet.org { server.document-root = /var/www/vhosts/chattypet.org/httpdocs/ url.rewrite-once = ( /(css|files|img|images|devedit|flash|js|stats|login)/(.*) = / app/webro /(.*)$ = /app/index.php?url=$1 ) } $HTTP[host] == www.chattypet.org { server.document-root = /var/www/vhosts/chattypet.org/httpdocs/ url.rewrite-once = ( /(css|files|img|images|devedit|flash|js|stats|login)/(.*) = / app/webro /(.*)$ = /app/index.php?url=$1 ) } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Save Date 1970
We are working with our hosting provider to upgrade Fedora/PHP/MySQL as after looking into this issue a bit more I think it is a problem that reaches beyond Cake due to our setup. Thank you for looking into this Zimmerman. I will post updates on here as soon as I make more headway with it. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Save Date 1970
I am not able to save dates before 1970. In my research I found that this is due to an issue with mktime on some Linux distros. Has anyone run into this? If so is there a quick fix I can apply? I've fixed this before in wordpress with the following: 1. Download the adodb Date Time Library at http://phplens.com/phpeverywhere/adodb_date_library 2. Move the file adodb-time.inc.php into the wp-includes folder 3. Modify functions.php and change all mktime,date and gmdate function calls: mktime(...) becomes adodb_mktime(...) date(...) becomes adodb_date(...) gmdate(...) becomes adodb_gmdate(...) Any tips are much appreciated. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Social Networking Example
Maybe you or someone can help me with another issue. When I switch over to production mode (DEBUG 0) I get Not Found notices for all my links. What could be causing this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Social Networking Example
Thanks! that worked! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Social Networking Example
In the past month I had the pleasure of creating a social networking site in Cake. We are still in BETA and would love to hear from the Cake community regarding any issues with the site. Please take a look at http://www.chattypet.com Thanks for an awesome framework and even better support along the way! Without all your help this initial step would've taken much longer than a month. We plan to eventually release the components on CakeForge. Please feel free to contact us if you're interested in exploring our social networking components sooner. You rock guys and gals! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
insert id after save?
If I'm saving a record as such: $this-Comment-save($this-params['data']) How do I get the id of the inserted/updated record so I can update associations/execute some custom sql? Thanks! Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Social Relationships?
Thank you everyone! Using a combination of: nate's hasAndBelongsToMany tip (something I should've noticed in the manual) and PhpNut's upgrade suggestion I got my social networking issues resolved. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Social Relationships?
Hi Everyone, We're building a Social Network app using cake. I ran into a problem I haven't been able to clear up from the documentation. I need to establish an association among my members. 1. My PHP version: PHP Version 5.0.5-2ubuntu1.2 2. My Cake version: 1.0.1.2708 I have a Users table, and a Relationship table. Now all would be fine if I could only follow the convention with associations, but in this case I don't think I can since I am creating relationships between two user_id's. My question is, how do I specify a custom association with Cake, that lets me establish this social networking table. I need two records created in the Relationship table (establish relationship) everytime a User becomes a friend of another User. Any help would be greatly appreciated, Thanks! Nick --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Stop Render View on AJAX Action?
Exactly what I was looking for - thanks! On May 30, 2006, at 8:14 PM, Chris Partridge wrote: Well, the groups is messing with my suggested code, but you should get the idea. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: Acccessing Helpers from Layout
Well I'm a bit of a noob, but what is: var $helpers = array('link'); Shouldn't it be: var $helpers = array('Html'); On May 23, 2006, at 10:35 PM, modfather wrote: I am attempting to add a Global menu to the layout file (thinking this is the appropriate place to put it). I tried the css-menu tutorial available in the wiki and it failed. I then again scaled back to test the following; class AppController extends Controller { var $helpers = array('link'); }//saved in app/app_controller.php class LinkHelper extends Helper { function makeEdit() { echo linkhelper; } }//saved as link.php in helpers directory. the created this as test.thtml in the elements directory. line 1 ?php echo $link-makeEdit() ? i then inserted ?php echo $this-renderElement('test'); ? in my views/layoutsdefault.thtml I have tried a few variations of this but i get a fatal error Call to a member function on a non-object in /cake/app/views/elements/test.thtml on line 1. would someone like to point me in right direction as to what i am doing wrong. cheers. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---